Checkpoint GUI enabled then disabled trouble

Hey, I have been trying to create a checkpoint GUI box that pops up for about 3 seconds to say the player hit a checkpoint, and then disappear. i have been messing around with this for days and looking at other people's ideas for turning GUIs off, to no avail. i already have the checkpoint GUI pop up when i run into a collider, Im now only having trouble turning it off. this was my last failed attempt, mostly due (i believe) to the yield object not working in the GUI function:

function OnGUI()
{
        if(check)
        {   
                GUI.Box(Rect(Screen.width - 100,0,100,50), "Check Point");
                timer = 1;
        }

        if(timer == 1)
        {
        yield WaitForSeconds(3);
        check = false;
        timer = 0;
        }
}

obviously, using javascript. any help would be greatly appreciated

var delay = 3.0;
private var checkTime = 0.0;
private var check = false;

function TurnOnCheck()
{
  checkTime = Time.time;
  check = true;
}

function OnGUI()
{
  if (check)
   GUI.Box(Rect(Screen.width - 100,0,100,50), "Check Point");
  if ((Time.time - checkTime) >= delay)
    check = false;
}

Call TurnOnCheck() somewhere, like when your checkpoint is reached.

Perhaps you need to amend your if statement:

if (check && !timer)

It's much simpler and more efficient if you enable and disable the script as appropriate. You should make the script disabled in the inspector by default, so it's only enabled when you call the ShowGUI function with the time you want it to be displayed.

function OnGUI()
{
    GUI.Box(Rect(Screen.width - 100,0,100,50), "Check Point");
}

function ShowGUI (timer : float)
{
    enabled = true;
    yield WaitForSeconds (timer);
    enabled = false;
}