Mathf.Clamp not working for float values.

I am following the project space shooter of unity’s completed projects but I have a problem with Mathf.Clamp taking float values as arguements where as the tutor in the video doesnt seem to have
any problem with it.Here’s the code I’ve written.

void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis(“Horizontal”);
float moveVertical = Input.GetAxis(“Vertical”);

   Vector3 movement =new Vector3(moveHorizontal, 0.0f, moveVertical) ;
   rigidbody.velocity = movement * speed;

   rigidbody.position = new Vector3(Mathf.Clamp(rigidbody.position,xmin,xmax),
       0.0f,
       Mathf.Clamp(rigidbody.position,zmin,zmax));


}

everything inside Vector3 is squiggly lined apart from 0.0f

Thanks in advance…!

Change rigidbody.position to rigidbody.position.x and rigidbody.position.z

You’re not passing a float to Mathf.Clamp(). Your first argument is a Vector3.

Mathf.Clamp(rigidbody.position,zmin,zmax)

rigidbody.position is not a float. Perhaps you want rigidbody.position.z ?