Bool script error

im having alittle trouble with this script ive typed up. So what its suppose to do is that when you press equiped items button if the current target is mage its suppose to set mage to true. And then if mage is true its suppose to activate the MageEquipedItems script. But heres the problem. First When i target the Mage it doesnt set mage to true, and then the second problem is no matter whats selected if i click equiped items its forcefully sets mage to true even if warrior is selected. Could you help me find out what i did wrong thats in advance!!

using UnityEngine;
using System.Collections;

public class LowerBar1 : MonoBehaviour {
	bool button1Clicked = false;
	bool button2Clicked = false;
	bool button3Clicked = false;
	bool button4Clicked = false;
	public GameObject target;
	public GameObject Mage;
	public GameObject Warrior;
   public bool mage = false;
	

	// Use this for initialization
	void Start () {
		mage = false;
	
	
	}
	
	// Update is called once per frame
	void Update () {
		if(mage == true){
		GetComponent<MageEquipedItems>().enabled = true;
		}
	
		
	
	}
	void OnGUI(){
		GUI.Box(new Rect(0,400,200,200), "");
		GUI.Box(new Rect(50,405,100,25), "GAME");
		GUI.Box(new Rect(0,430,100,25), "Game Type:");
		GUI.Box(new Rect(0,455,100,25), "Phase:");
		GUI.Box(new Rect(0,480,100,25), "Ally Heroes:");
		GUI.Box(new Rect(0,505,100,25), "Enemy Heroes:");
		GUI.Box(new Rect(0,530,100,25), "Monsters:");
		GUI.Box(new Rect(0,555,100,25), "Total Gold:");
		GUI.Box(new Rect(200,400,200,90), "");
		GUI.Box(new Rect(200,405,100,20), "Hero:");
		GUI.Box(new Rect(200,425,100,20), "Level:");
		GUI.Box(new Rect(200,445,100,20), "Health:");
		GUI.Box(new Rect(200,465,100,20), "Mana:");
		GUI.Box(new Rect(200,490,200,110), "");
		GUI.Box(new Rect(400,420,400,180), "");
		
		if(button1Clicked)
			GUI.color = Color.red;
				else
			GUI.color = Color.white;
		
		if (GUI.Button(new Rect(400,400,100,20), "Inventory")){{
			button1Clicked = true;
			button2Clicked = false;
			button3Clicked = false;
			button4Clicked = false;
		}
			GetComponent<Inventory>().enabled = true;
			GetComponent<MageEquipedItems>().enabled = false;
		}
		if(button2Clicked)
			GUI.color = Color.red;
				else
			GUI.color = Color.white;
		
		if (GUI.Button(new Rect(500,400,100,20), "Equiped Items")){{
			button1Clicked = false;
			button2Clicked = true;
			button3Clicked = false;
			button4Clicked = false;
		}
			GetComponent<Inventory>().enabled = false;
			mage = GameObject.Find("Mage");
			if(target == mage){
				mage = true;
			}
			
			
			
			
			
		}
		if(button3Clicked)
			GUI.color = Color.red;
				else
			GUI.color = Color.white;
				
		if (GUI.Button(new Rect(600,400,100,20), "Stats")){{
			button1Clicked = false;
			button2Clicked = false;
			button3Clicked = true;
			button4Clicked = false;
		}
			GetComponent<Inventory>().enabled = false;
			GetComponent<MageEquipedItems>().enabled = false;
		}
		if(button4Clicked)
			GUI.color = Color.red;
				else
			GUI.color = Color.white;
		
		if (GUI.Button(new Rect(700,400,100,20), "?")){{
			button1Clicked = false;
			button2Clicked = false;
			button3Clicked = false;
			button4Clicked = true;
		}
			GetComponent<Inventory>().enabled = false;
			GetComponent<MageEquipedItems>().enabled = false;
		}
	}
}

Do you assign ‘target’ in the inspector? If you don’t then your test for ‘target == mage’ will always be false.

Also, instead of setting the Component to true every frame, you should probably just do it once; when needed.

GetComponent<MageEquipedItems>().enabled = target == mage;