Script problems

hey guys whats wrong with this one??

would you like to help me please


Every thing works fine but when i trigger is the second time the gui text wont appear again and the f key doesnt work also the second time i walk it the trigger

var Component : GUIText;
var GameObject : GameObject;

function OnTriggerEnter(other : Collider) {
     Component.guiText.text = "Press f to talk to the Comander";
}

function OnTriggerStay(other : Collider) {
    if( Input.GetKeyDown( "f" ) )
    {
        audio.Play(03);
    }
}

function OnTriggerExit(other : Collider) {
     Component.guiText.text = "";
     active = false;
    if function (OnTriggerEnter(other : Collider)){
    {
     Component.guiText.text = "Press f to talk to the Comander";
     active = true;
    }
}


i have tweaked this but sutch no luck

var Component : GUIText;

function OnTriggerEnter(other : Collider) {
     active = true;
     Component.guiText.text = "Press f to talk to the Comander";
}

function OnTriggerStay(other : Collider) {
    if( Input.GetKeyDown( "f" ) )
    {
        audio.Play(03);
    }
}

function OnTriggerExit(other : Collider) {
     gameObject.Component.active.guiText.text = "";
     active = false;
}

First of all, having variables with the same name as an existing type (Component, GameObject) is a BAD idea. Also you are doing some funky stuff (gameObject.Component.active.guiText.text = "";), which I'm amazed that it goes through the compiler. Anyhow try something like this:

var isActive : bool = false;

function OnTriggerEnter()
{
  guiText.text = "bla";
  isActive = true;
}

function OnTriggerExit()
{
  guiText.text = "";
  isActive = false;
}

function Update()
{
  if (isActive && Input.GetButtonDown("Fire1")
  {
    Debug.Log("clicked");
  }
}

try this it might work

var Component : GUIText;
var GameObject : GameObject;

function OnTriggerEnter(GameObject : Collider) {
    Component.guiText.text = "Press f to talk to the Comander";
}

function OnTriggerStay(GameObject : Collider) {
    if( Input.GetKeyDown( "f" ) )
    {
        audio.Play(03);
    }
}

function OnTriggerExit(GameObject : Collider) {
    Component.guiText.text = "";
}