Error with trigger PLZ HELP!!!!

I Tryed

function OnTriggerEnter(){
    if(GUI.Button(Rect(10,50,50,30),"Enter"))
    if  (stringToEdit == "times")
    {
        Application.LoadLevel("Scene2");
        Screen.showCursor = true;			
    }
}

So when the player triggers the cube trigger then this happends
but it dont work why not PLZ HELP!!!
(im a noob)

That’s a very frequent error: GUI items can only be used inside the function OnGUI. The solution is to set a boolean when the player is inside the trigger and use it to enable the GUI item inside OnGUI:

private var inTrigger = false;

function OnTriggerEnter(other: Collider){
    if (other.CompareTag("Player")){ // remember to tag the player as "Player"!
        inTrigger = true; // player entered trigger
    }
}

function OnTriggerExit(other: Collider){
    if (other.CompareTag("Player")){
        inTrigger = false; // player left trigger
    }
}

function OnGUI(){
    // button Enter only appears when the player is inside the trigger
    if (inTrigger && GUI.Button(Rect(10,50,50,30),"Enter")){
        if (stringToEdit == "times"){
            Application.LoadLevel("Scene2");
            Screen.showCursor = true;
        }
    }
}