Pause game OnTriggerEnter

My idea is when an object " collide " with the " cubo2 " to pause the game , my script works but when the object goes out of this " cubo2 " the game is still not , someone help me ?

var paused : boolean = false;

// Destroy everything that enters the trigger
function OnCollisionEnter (other : Collision) {
if(other.gameObject.tag == “cubo2”);
if(!paused){
Time.timeScale = 0;
paused=true;
}else{
Time.timeScale = 1;
paused=false;
}

}

Use OnCollisionExit to handle the case of an object exiting the cube. OnCollisionEnter will only be called when the object enters the cube.