Toggling GUI on/off help

I need if to go on and off if a press the Tab button but for some reason it doesnt do anything. what am i doing wrong. below is the main parts of code im trying to get to work so dont worry, the function update is there.

        public ShipMenu shipGUI;

        if(Input.GetKeyDown (KeyCode.Tab) && shipGUI.enabled == true)
			shipGUI.enabled = false;
		if(Input.GetKeyDown (KeyCode.Tab) && shipGUI.enabled == false)
			shipGUI.enabled = true;

You are disabling a script with that code, not any renderers if it had any attached to the game object.

Also as a tip for what it’s worth - you could condense that code down to:

if (Input.GetKeyDown (KeyCode.Tab))
    shipGUI.enabled = !shipGUI.enabled;

Perhaps you wanted to disable the entire game object?

var guiGameObject = shipGUI.gameObject;

if (Input.GetKeyDown (KeyCode.Tab))
    guiGameObject.SetActive (!guiGameObject.activeSelf);