Max Height Move Vertical - JS

Hi Guys.

Sorry for english,

I had made a code for move in vertical in a 2D game.

I can move, but the limit for max. and min. don’t work.
Seems that they said that a have to assing the object, but i already did it

It’s simple, i know… But what’s wrong?

THANKs!

var player : GameObject;
var maxHeight : float;
var minHeight : float;
var speed : float;


function Start () {


}

function Update () {

	var move = Input.GetAxis("Vertical") * speed;
	player.transform.Translate(0,move,0);
	}
	
	if (player.transform.position.y > maxHeight) 
	{
	player.transform.position = new Vector2 (0, maxHeight);
	}

I see no code for ‘min’ here. Your ‘max’ code is out side of your Update() function. Move line 16 to below line 21. And if you are getting an error about ‘player’ not being assigned, look for more than one copy of your script on game object.