Time.Timescale = 0 in two different places, But there's a delay.

I have Time.Timescale =0 in two different place. One “Pause” at time of death, another “pause” is opening the menu. Timescale = 0 works for both, individually. However, if the player dies, and then you open or close the menu, it “un-pauses” for about 3 or 4 secs, then “pauses” again. Why the delay? I have the pause/open&close menu on a toggle. Don’t think the code for pause at death is the problem. Here is the code for the toggle:

if (Time.timeScale == 0)
Time.timeScale = 1;
else
Time.timeScale = 0;

If you die, the timescale is 0, and then you open a menu, won’t that set timescale back to 1 again?

var dead: boolean;
var pause: boolean;

        function Update()
        {
        if(dead)
       {
             pause = false;
       }
        if(!dead && !pause)
        {
        Time.timeScale = 1.0; // unless you have some slomo
        }
        else
        {
        Time.timeScale = 0.0;
        }
        }