simple clamp camera translate on Y axis only

I have a script for my camera on my player so that the camera can move up and down on the y axis. I don’t want the camera to move left and right because my player already rotates left and right on the x axis and the camera follows because it is the players child. Now the problem is that the camera rotates too far up or too far down which is why I need a clamp or bonds for it. I have looked all over Google and other sites but I can not find anything the fits what I’m looking for. All I need is a clamp on the y axis when input axis horizontal is pushed but I also want the camera to follow the player when it moves up and down. Thanks for your help, here’s my script.

private var player : Transform;
private var speed : float = 10;

function Update() {
	player = GameObject.Find("Gabriel Health Bar Red").transform;
	transform.LookAt(player);
	var translation = Input.GetAxis ("Mouse Y") * speed;
	translation *= Time.deltaTime;
	transform.Translate (0, translation, 0);
}

not sure if this is 100% what you wanted but the code will lock the camera movement along the axis you chose, just put it in a script and attach that to the camera

// Update is called once per frame
void Update () {
	transform.position = new Vector2 (0, transform.position.y);
}

Never mind I figured it out but thanks!
private var player : Transform;
private var speed : float = 10;

 function Update() {
    player = GameObject.Find("Gabriel Health Bar Red").transform;
    transform.LookAt(player);
    var translation = Input.GetAxis ("Mouse Y") * speed;
    translation *= Time.deltaTime;
    transform.Translate (0, translation, 0, Space.World);
	if (Vector3.Distance(transform.position, player.position) > 8) {
        transform.position += transform.TransformDirection (Vector3.fwd);
    }
    if (Vector3.Distance(transform.position, player.position) < 6) {
        transform.position -= transform.TransformDirection (Vector3.fwd);
    }
}