X and Y Camera Movement

Hey guys, i want my Camera to follow my charachter the Y Axis but not the X.
How do i do that?

Here is how I did it:

//set this to the object to follow
var followObject : GameObject;
 
//I recommend moving the camera in the LateUpdate method
function LateUpdate()
{
    var camPos : Vector3 = Camera.main.transform.position;
    camPos.x = followObject.transform.position.x;
    Camera.main.transform.position = camPos;
}

I have not tested it, but i should work.
-Nelis

Hmm, i attached it to my Camera but nothing seems to happen