problem using input key inside a trigger for calling an image (gui texture)

so i am trying to make when player entering a collider/trigger it will show text telling them to press a key, and then when the key pressed (still inside the collider/trigger) the game will paused and an image will pop up.

there is no problem with the text but when i press the key the image doesn’t show at all

is there something wrong with my code? (i am us9ng first person controller prefab)

var textinfo: GUIText;
var popupimg: GUITexture;

function Start(){
	popupimg.enabled = false;
		
}

function OnTriggerEnter() {
	textinfo.text = " Press E for info";
	if(Input.GetKey(KeyCode.E)){
		Time.timeScale = 0;
		Destroy(teksinfo);
		popupimg.enabled = true;
	}
}

Just go at it from a different angle. OnTriggerEnter only calls as soon as you enter the trigger, and I’m not sure if having the key held down before entering would fire the input or not but I’m almost positive it wouldn’t if you hit the key afterwards (never tried it the way you’re trying to) … Give yourself another boolean for whether or not you’re in the trigger, and if so, then you can use a key.

e.g. :

var inTrigger : boolean = false ;

function Update(){
   if(inTrigger){
      if(Input.GetKeyDown(whatever)){
         //do stuff ;
      }
   }
}

function OnTriggerEnter(){
   inTrigger = true ;
}

function OnTriggerExit(){
   inTrigger = false ;
}