Pause Button Problems

so i'm in a scripting class and we are making a simple game. we are adding a pause button and i'm having trouble. i have it to the point where the GUI.toggle button shows up and pauses the game when you click it but i can't get it to unpause. when you pause the game all of the GUI dissapeares like its supposed to, i just don't know how to make it so that you can up pause it. Here is my script:

var theButtonWidth:int;
var theButtonHeight:int;
var theButtonSpace:int;
var thePauseButton = false;
var gamePaused : boolean = false;
var theRate = 1;

var labelwidth: int;
var labelheight: int;

static var theCashCount: int;
static var theAmmoCount: int;
static var theHealthCount: int;

function OnGUI (){
    if (theRate !=0) {
        GUI.Box (Rect (Screen.width*.75,Screen.height*.88-(labelheight+theButtonSpace)*2, labelwidth, labelheight), "Health Amount: " + theHealthCount);
        GUI.Box (Rect (Screen.width*.75,Screen.height*.88-(labelheight+theButtonSpace), labelwidth, labelheight), "Cash Amount: " + theCashCount);
        GUI.Box (Rect (Screen.width*.75,Screen.height*.88-(labelheight+theButtonSpace)*3, labelwidth, labelheight), "Ammo Amount: " + theAmmoCount);

    var weaponSwitchButton = GUI.Button (Rect (Screen.width*.1,Screen.height*.88, theButtonWidth, theButtonHeight+theButtonSpace), "Weapon Switch");

            print("Changed Weapon");

    var thePauseButton = GUI.Toggle (Rect ((Screen.width)-((theButtonWidth*3)+(theButtonSpace*4)), theButtonSpace, theButtonWidth, theButtonHeight), thePauseButton, "Pause");

        PauseTheGame (0);
        gamePaused = true;
        PauseTheGame (1);
        gamePaused = false;
    else if (Input.GetKeyDown(KeyCode.Space) && gamePaused)
        PauseTheGame (1);
        gamePaused = false;


function PauseTheGame (theRateScale){
    Time.timeScale = theRateScale;
    Time.fixedDeltaTime= theRateScale;
    theRate = theRateScale;

i've tried a few things like attempting to add an unpause with a GetKey and the like, but it doesn't ever seem to work exactly right. i've had it where it will print pause and resume in the console but won't actually pause.

This script is ok

var thePauseButton = false;

function OnGUI ()
   thePauseButton = GUI.Toggle (Rect (100,50,100,30), thePauseButton, "Pause");
   if (thePauseButton)
      Time.timeScale = 0.0;
      Time.timeScale = 1.0;

so, all of a sudden, this script worked exactly like i wanted it to.

makes me kinda mad actually....