GUI Box appear when you are close to something?

Hi, I have a door that I have connected to another scene, and I want to have it so that once I get close to the door, a GUI Box will popup to tell the player where the door goes. What I was thinking was that in the Update Function, once the player gets close to the door, this will set a boolean true, and then in the OnGUI function, if that boolean is true, then the GUI box would appear, but this is not happening. When I get close to the door, nothing happens. Here is my script:

#pragma strict

var player : GameObject;
var sheddoor : GameObject;

var playersheddoordist = Vector3.Distance(player.transform.position, sheddoor.transform.position);

var guibox = Rect(190, 175, 160, 160);

var guiboxboolean : boolean = false;

function Start () {

}

function Update () 
{
	if (playersheddoordist > 3)
    {
        guiboxboolean = true;
    }
    else
    {
        guiboxboolean = false;
    }

function OnGUI ()
{
    if (yesnoone)
    {
        GUI.Box (guibox, "Enter Shed?");
    }
}

Any ideas of how I could fix this? Thanks in advance.

You cannot do a calculation outside of a function :

var playersheddoordist = Vector3.Distance(player.transform.position, sheddoor.transform.position);

this should be :

var playersheddoordist : float;

function Update ()
{
    playersheddoordist = Vector3.Distance(player.transform.position, sheddoor.transform.position);
    if (playersheddoordist > 3) // etc ....

or simply :

function Update ()
{
    var playersheddoordist : float = Vector3.Distance(player.transform.position, sheddoor.transform.position);
    if (playersheddoordist > 3) // etc ....