activate gui on trigger enter

what im trying to do i activating a gui if the person enters a trigger then reset to hide if exiting a trigger

var showGUI = false;

var source2 : Texture2D;

var source : Texture2D;

function OnTriggerEnter(other : Collider){

if(other.gameObject.tag == “source”){

GUI.Box (Rect (10,10,200,100), GUIContent(“400”, source));

   showGUI  = true;

   GUI.enabled = true;

}

}

function OnTriggerExit(other : Collider){

if(other.gameObject.tag == “source2”){

GUI.Box (Rect (10,10,200,100), GUIContent(“400”, source2));

   showGUI  = false;

   GUI.enabled = true;

}

}

function ongui () {

GUI.Box (Rect (10,10,200,100), GUIContent(“400”));

GUI.enabled = true;

}

EDITED

Ok, I changed this for what you said below, I think this should work. Just attach this script to your player ... You'll have to modify it for whatever other content you're wanting to do, I'm just showing you a way I think for you can trigger the gui.

var showGUI : boolean = false ;
 
function OnTriggerEnter(hit : Collider){
   if(hit.gameObject.tag == "MyGuiDoohickeyTagWhateverInamedIt"){
   showGUI = true ;
   }
}
 
function OnTriggerExit(hit : Collider){
   if(hit.gameObject.tag == "MyGuiDoohickeyTagWhateverInamedIt"){
   showGUI = false ;
   }
}
 
function OnGUI(){
   if(showGUI){
        //do what you're doing with gui.. making your box or whatever
   }
}

I think that should do it. Just tag your GUI trigger object whatever you want and replace the "MyGuiDoohickeyTagWhateverInamedIt" in the script to whatever your tag is called. Then add some script for GUI.Box or whatever down near the bottom there.