Help with crouch script!

I have this crouch script I got from this link,

http://forum.unity3d.com/threads/48187-scale-character-controller-but-not-player

Here is the script,

var controller : CharacterController;
 
 
function Update ()
{
   if (Input.GetKey   ("c")) {
      controller.height = 0.5;
      controller.center = 0.25;
   } else {
      controller.height = 2.0;
       controller.center= 0.5;
   }
   }

It’s supposed to shrink the character controller capsule, so that it can go under objects. But I keep getting this, “Cannot convert ‘float’ to 'UnityEngine.Vector3” I’m not sure what is means.

I know the problem is with those controller.center pieces. But they are really important because they keep the character from sinking into the ground. Thanks for reading, this crouch has been bugging me for quite some time.

-Rov

controller.center is a Vector3 so it will need to be reassigned in the form of a Vector3 (x,y,z)

//i'm guessing you want to just change the y so i keep the current x and z
controller.center = Vector3(transform.position.x, 0.25, transform.position.z);

I think all you need is this just go to this and enjoy ------> Run & Crounch Script For Player

Don’t forget to mark the answer if Found useful…Cheers…