I have 4 cubes and when they enter four boxcolliders the boxcolliders set a cube active if all for cubes are set active then this script will set a key active C# (Not Working)

this is my script

using UnityEngine;
using System.Collections;

public class ColorDetector : MonoBehaviour 
{
	public GameObject Key;

	void OnTriggerEnter (Collider Keyz)
	{
		if (Key.gameObject.tag == "Yellow") 
		{
			if (Key.gameObject.tag == "Blue") 
			{
				if (Key.gameObject.tag == "Red") 
				{
					if (Key.gameObject.tag == "Green") 
					{
						Debug.Log ("IT Worked");
						Key.SetActive (true);
					}
				}
			}
		}	
	}
}

@rapinnz there i know i answered your other one but this has the part where if all are triggered

public bool havekeyBlue = false;
public bool havekeyGreen = false;
public bool havekeyRed = false;
public bool havekeyYellow = false;
public GameObject me;
void Start()
{
}
void Update()
{
    if(havekeyBlue==true && havekeyGreen==true && havekeyRed==true && havekeyYellow==true)
    {
        //add  what you want to happen here when you have all the keys
    }
}
private void OnTriggerEnter(Collider collider)
{
    if (collider.CompareTag("BlueKey"))
    {
        havekeyBlue = true;
    }
    if (collider.CompareTag("GreenKEy"))
    {
        havekeyGreen = true;
    }
    if (collider.CompareTag("RedKey"))
    {
        havekeyRed = true;
    }
    if (collider.CompareTag("YellowKey"))
    {
        havekeyYellow = true;
    }
}

@rapinnz
Change This:

 using UnityEngine;
 using System.Collections;
 
 public class ColorDetector : MonoBehaviour 
 {
     public GameObject Key;
 
     void OnTriggerEnter (Collider Keyz)
     {
         if (Key.gameObject.tag == "Yellow") 
         {
             if (Key.gameObject.tag == "Blue") 
             {
                 if (Key.gameObject.tag == "Red") 
                 {
                     if (Key.gameObject.tag == "Green") 
                     {
                         Debug.Log ("IT Worked");
                         Key.SetActive (true);
                     }
                 }
             }
         }    
     }
 }

To this:

 using UnityEngine;
 using System.Collections;
 
 public class ColorDetector : MonoBehaviour 
 {
     public GameObject Key;
 
     void OnTriggerEnter (Collider Keyz)
     {
         if (Keyz.gameObject.tag == "Yellow") 
         {
             if (Keyz.gameObject.tag == "Blue") 
             {
                 if (Keyz.gameObject.tag == "Red") 
                 {
                     if (Keyz.gameObject.tag == "Green") 
                     {
                         Debug.Log ("IT Worked");
                         Key.SetActive (true);
                     }
                 }
             }
         }    
     }
 }

All I did was add a ‘z’ to each part. Stuff like this can make a huge change.