Pause Problem

Hey guys im working on a game where u need to dodge other cars that are driving towards you.
I have a menu working and all but somehow i cant manage to make my pause script working.

this is my script.

var isPaused : boolean = false;

function Update()
{
    if(Input.GetKeyDown("Enter") && isPaused)
    {
        print("Paused");    
        Time.timeScale = 0.0;
        isPaused = true;
    }
    else if(Input.GetKeyDown("Enter") && isPaused)
    {
        print("Unpaused");
        Time.timeScale = 1.0;
        isPaused = false;   
    } 
}

Did you mean to have a “not” operator before the first isPaused, so the logic reads if-enter-pressed-and-not-paused?

var isPaused : boolean = false;

function Update()
{
    if(Input.GetKeyDown("Enter") && !isPaused) // <- Right here!
    {
        print("Paused");    
        Time.timeScale = 0.0;
        isPaused = true;
    }
    else if(Input.GetKeyDown("Enter") && isPaused)
    {
        print("Unpaused");
        Time.timeScale = 1.0;
        isPaused = false;   
    } 
}