Im not getting any errors at all… It just wont find the player and when i manually drag the object to the inspector it wont move the player up…
var player : GameObject;
var speed : float;
var enterTrig : boolean = false;
function OnTriggerStay (other : Collider) {
if (player != null) {
var player = other;
enterTrig = true;
}
}
function OnTriggerExit(other : Collider) {
var player = null;
enterTrig = false;
}
function Update () {
if (player != null && enterTrig == true && Input.GetKeyDown(KeyCode.W)) {
player.transform.position.y += speed * Time.deltaTime;
}
}