Countdown remove gui.box

I’ve searched google a few times for this with no luck but I want to delete a certain countdown GUI.Box after 5 seconds. But i cant find a way to remove a particular GUI.Box. Here is my code. i want the if (Ball_Movement.playerDead == true)
GUI.Box(new Rect(180, 400, 100, 20), “”+respawnCountDown);
to be deleted after 5 seconds. Also how do i force the textbox to read it as a int? right now that timer is showing up in my scoreboard script as a float countdown, i want it to be 1 2 3 4 5.

using UnityEngine;

using System.Collections;

public class ScoreBoard : MonoBehaviour {
// made your score static (changed it to score rather than scorboard global ur call)
//public static ScoreBoard instance;
public static ScoreBoard global;
public static float Score = 0f;
public static float Lives = 3f;
public static float respawnCountDown = 0;
public static float Timer = 0;
// Use this for initialization
void Start () {
//global=this;
}

// Update is called once per frame
void Update () {
    if (Score >550) // should be 550
    {
        Application.LoadLevel("YouWon");
    }
    if (Timer == 5f)
    {
        // delete the particular gui box here
    }
    
}
// Makes a GUI from the variable score which needs to be tied to when a block dies.
void OnGUI()
{
    GUI.Box(new Rect(10, 0, 100, 20), "" + Score);
    GUI.Box(new Rect(350, 430, 100, 20), "" + Lives);
    if (Ball_Movement.playerDead == true)
    {
        Wait();
        GUI.Box(new Rect(180, 400, 100, 20), ""+respawnCountDown); 

    }
}
void Wait()
{
    respawnCountDown = Timer++ * Time.deltaTime;        
}

}

Here’s the relevant code:

void OnGUI()
{
   if ( countdown )
     GUI.Box(new Rect(180, 400, 100, 20), ((int)respawnCountDown).ToString()); 
}

// Just call this when ever you want to show the countdown
public void ShowCountdown()
{
   StartCoroutine(Countdown());
}

private IEnumerator Countdown()
{
   countdown = true;
   respawnCountDown = 5;
   while ( respawnCountDown > 0 )
   {
      respawnCountDown -= Time.deltaTime;
      yield return null;
   }
   respawnCountDown = 0;
   countdown = false;
}

The following script should achieve what you are looking for.

private var countDown:int = -1;
private var nextEvent:float;
   
function StartCountDown()
{
  	countDown = 5;
   	nextEvent = Time.time + 1;
}

function OnGUI()
{
	if (countDown >= 0)
	{
		GUI.Box(new Rect(100,400, 100, 20), "" + countDown);
		if (Time.time > nextEvent)
		{
			nextEvent = Time.time + 1;
			countDown--;
		}
	}
	
	if (GUI.Button(new Rect(100, 450, 100, 20), "Start"))
	{
		StartCountDown();
	}
}

It contains a button called “Start” that, when pressed, calls “StartCountDown”. This starts the count down and while the count down is valid, shows the box containing the countdown.

(Oh … I coded this up and this is a cut/paste from the working script).