ending space shooter game

Hi guys I am almost done with space shooter tutorial I just need to end the game so I came up with a code that checks if the player is alive or not and breaks the spawning hazards loop to display game over and press r to restart . here it is :

var hazard : GameObject;
var spawnValues : Vector3;
var hazardCount : int;
var spawnWait : float;
var startWait : float;
var waveWait : float;
static var score : int;

function Start () {
 
   SpawnWaves ();
  
   
} 


function SpawnWaves () {
    yield WaitForSeconds (startWait);
    while (true)
    {
        for ( var i : int= 0; i < hazardCount; i++)
        {
             var spawnPosition : Vector3= new Vector3 (Random.Range (-12,12),0,17);
             var spawnRotation : Quaternion= Quaternion.identity;
            Instantiate (hazard, spawnPosition, spawnRotation);
            yield WaitForSeconds (1);
        }
        yield WaitForSeconds (1); 
        }             
 }   


function OnGUI () {
		GUI.Label (Rect (10, 10, 100, 20), "Score: " + score);
		}
		
		
		
		 if (other.tag "Player" == null) {
        break;
        function OnGUI () {
        GUI.Label (Rect(50,50,50,20), "Game Over");
        }
        function OnGUI () {
        GUI.Label (Rect( 70,70,50,20), "Press R to Try Again");
        }
         if (Input.GetKeyDown (KeyCode.R))
        {
            Application.LoadLevel (Application.loadedLevel);
        }
        }

there are some errors with it I hope that you help me out with it .

Put all OnGUI items in to one function OnGUI(). Don’t attempt to use multiple instances of it in your script.

I need to close this QA.

I suggest you look at other script examples to get a better idea of how to structure your code. Don’t take it personally but answering your question would be like finishing the tutorial / writing your game for you.