Toggling my minimap

I have a minimap in my game that I want to toggle on and off with Z. So far, zero luck. It doesn’t turn it off, it doesn’t turn it on. Here is my code:

 var minimap : GameObject;
    var actives : boolean;
    function update(){
    if (Input.KeyDown(KeyCode.Z)){
    if (actives == true){
    minimap.SetActive(false);
    actives = true;
    }
    if (actives == false){
    minimap.SetActive(true);
    actives = true;
    }
    }
    }

So, what am i doing wrong? Please help me!

Try this:

if (Input.KeyDown(KeyCode.Z)){
actives = !actives;
}