Mouse won't lock

HI! :smiley: im new here and still learning UnityScript. But i have a Problem.
I have a script that Pause the game and Unlock the Mouse. But when i Resume. The Mouse is still Unlocked! any Ideas?

Script:

private var pauseEnabled = false;

function Start(){

    pauseEnabled = false;

    Screen.lockCursor = true;

    Screen.showCursor = false;

}

function Update(){

if(Input.GetKeyDown(“escape”)){

if(pauseEnabled == true){

pauseEnabled = false;

Screen.lockCursor = true;

Screen.showCursor = false;

 }else{

 if(pauseEnabled == false){

             pauseEnabled = true;

             Screen.lockCursor = false;

             Screen.showCursor = true;

    }

}

}

}

It is unwise to use escape as the lock and unlock key.

By default, the Unity Editor and Webplayer both UNLOCK the cursor when you press escape, so no one can trick an online player into having their mouse permanently stuck.

In a standalone build, this script will work fine, but it is still not recommended.

Instead, you should use mouse click to re-lock the cursor.