Solution :
I think you are missing the new keyword that is very necessary to call any constructor from C# code. Maybe your code was improperly translated from another language (e.g. your syntax is valid in Python), or you have just written wrongly.
The correct way to write the code is as below:
transform.Translate(new Vector3(myxP, 0, 0));
You must consider writing the code with the Vector3.right instead, to clarify the direction
Please find below the code written using Vector3.right
transform.Translate(Vector3.right * myxP);
OR
When you want to use the C# you must use the new keyword in front of all the constructors. The Constructors are like the functions that are used to create new objects . They must have the same name as the type of the object you want to create. So if you want to create a new Rect using your constructor Rect() then you must write new Rect() if you are using C#.