Anybody have a script that freezes the camera x and z positions

Trying to make a 2d arcade game and I just want the camera to go down on the y axis with the character as they progress but I can’t get it to do it.

If i understand correctly: If you want a script solution this should do the trick (apply the script on the camera):

public GameObject player;
void Update() {
	transform.position.y = player.transform.position.y;
}