Show GUI.Label when touching trigger

So yeah, I’m trying to make something like this:
When player is touching the invisible box (no collider). GUI.Label shows on the screen. When he’s leaving the trigger, the label hides. The problem is that I should use function OnTriggerEnter, but for GUI I should use OnGUI. Any clue what I should do?
Scripts:

    var Guiscript : image1 ;
    
    function OnTriggerEnter (other : Collider)) {
    if (Guiscript.enabled == true){
    Guiscript.enabled = false;
    }
    else {
    Guiscript.enabled = true;
    }
    }
    }

image1 script:

function OnGUI () {
GUI.Label (Rect (10, 300, 100, 20), "TEXT");
}

Hi!

Use a boolean to toggle the OnGUI.
This boolean must be set in the OnTriggerEnter()/Exit().

var toggleGUI : bool; // Set it in the event Enter/Exit
function OnGUI () {
if (toggleGUI == true)
    GUI.Label (Rect (10, 300, 100, 20), "TEXT");
}

Good luck.

Ok never mind it was my fault. I finally figured it out. I had some bodies of dead soldiers within the trigger area and this was setting it off on game start. Thank you for your help regardless :slight_smile:

thank you for the script! It worked for me with a little tweaking.
CT

This can work for any guitext you have in the object

using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.IO;

public class Showtext : MonoBehaviour {
	GUIText guiText;
	// Use this for initialization
	void OnTriggerEnter(Collider other) {
		guiText.enabled = true;
	}
	void OnTriggerExit(Collider other) {
		guiText.enabled = false;
	}
a