PauseButton Not working

When i pause the game there is an option to quit. But if restart the game without refreshing it, it stays paused and you have to press p before being able to play. here's my script:

static var timeScale : float =1.0;
// Toggles the time scale between 1 and 0.7
// whenever the user hits the Fire1 button.
var Ispaused : boolean =false;

function Update () {
    if (Input.GetKeyDown ("p")) {
        if (Time.timeScale == 1.0) {
            Time.timeScale = 0;
            Ispaused=true;
        }
        else {
            Time.timeScale = 1.0;
            Ispaused=false;
        }
        Time.fixedDeltaTime = 0.02 * Time.timeScale;
    }

}

function OnGUI () {
    if(Ispaused){
    // Make a background box
    GUI.Box (Rect (200,200,100,90), "Pause Menu");

    if (GUI.Button (Rect (200,220,80,20), "Quit")) {
        Application.LoadLevel (0);
        Ispaused=false;
    }
    }

}

i tried putting Ispaused=false at the end when reloading but it didn't help =|. How do i fix this? thanks! :D

In your OnGUI-method, you only set Ispaused = false - but you don't reset the timeScale to 1.0. So it should probably be:

if (GUI.Button (Rect (200,220,80,20), "Quit")) {
    Application.LoadLevel(0);
    Time.timeScale = 1.0;
    Ispaused=false;
}

Also, just to be on the safe side, you should probably add:

function Start() {
    Time.timesScale = 1.0;
    Ispaused = false;
}

In general, I'd recommend creating methods for pausing and starting again instead of copy'n'pasting the code snippet (that is always error prone):

function StartPause() {
    Time.timesScale = 0.0;
    Ispaused = true;
}

function ExitPause() {
    Time.timesScale = 1.0;
    Ispaused = false;
}

Also, your if-check in Update() seems very easy to break (if Time.timeScale == 0.99, it will fail). So, what you might want to do instead is:

function Update () {
    if (Input.GetKeyDown ("p")) {
        if (!Ispaused) {
            StartPause();
        } else {
            ExitPause();
        }
        Time.fixedDeltaTime = 0.02 * Time.timeScale;
    }
}

function OnGUI () {
    if (Ispaused) {
        // Make a background box
        GUI.Box(Rect(200,200,100,90), "Pause Menu");

        if (GUI.Button(Rect(200,220,80,20), "Quit")) {
            Application.LoadLevel (0);
            ExitPause();
        }
    }
}