Display gui box after trigger is activated?

Hello I am making a 2D game and I would like to know how to make a gui box (the default gui things) appear after a trigger is activated. This is my script (I have two ones since I have a gameobject to display the guibox) The first script is named “badsweet”

#pragma strict

var offsetY : float = 40;
var sizeX : float = 100;
var sizeY : float = 40;

function OnGUI () 
{
	if (youdied1.guiShow == "true");
	{
		GUI.Box (new Rect (Screen.width/2-sizeX/2, offsetY, sizeX, sizeY), "You Died, Press R to Restart Level");
	}
}

The second one is called “youdied1”

#pragma strict

static var guiShow;

function OnTriggerEnter2D (other : Collider2D)
{
	if(other.tag == "Player")
	{
		guiShow = true;
	}
}

function OnTriggerExit2D (other : Collider2D)
{
	if(other.tag == "Player")
	{
		guiShow = true;
	}
}

With the code applied as it is now the gui box is constantly being displayed.Sorry if this sounds overly complicated. Thanks

it constantly shows because you have not initiated the bool guiShow as false in the beginning of the code.

static var guiShow = false;

I’m not used to javascript, but try using

if (youdied1.guiShow)

or

if (youdied1.guiShow == true)

I guess that may be the problem