triggering a door to open with a button

im trying to figure out how to trigger my hoist door to open with the space bar. however i only want to be able to open the hoist door when im in the trigger box that i made. the script im using gives no errors but it still doesnt work. heres the script:

var doorUp : AnimationClip;


function OnTriggerEnter (mytrigger : Collider) {

if(mytrigger.gameObject.name == "player" )
{
	
	if(Input.GetButton("openDoor"))
{
		door = gameObject.Find("door");
		door.animation.Play("hoistDoorUp");
	}
	
	
}
}

The first thing that pops out at me is that you’re using OnTriggerEnter and not OnTriggerStay.

The former will only fire for the frame it occurs on (better be holding down the openDoor key) whereas the latter will check for the keypress as long as you’re in the trigger area.