Acces variables from script that is on multiple objects

I have a pedestal that will be active only if object of right color/material will be on it. Those object can change color if player press certain buttons. How do i find out if the obejct is right color? I was thinking about something like making 3 bool variables called red, green, blue in the script that is on those objects and then switching them between true/false depending on what color the object have. But i dont know how to access those variables only on one object. I would be really thankfull if someone could help me.

Here is an example of 2 alternatives where you keep track of all objects that are currently existing.

public class ColoredObject : MonoBehaviour
{
    internal int color;
    internal bool placedOnPedistal = false;
}

public class AccessingObject : MonoBehaviour
{
	public ColoredObject coloredObjectBlueprint; //must be set in inspector
	
	List<ColoredObject> coloredObjectsAlt1 = new List<ColoredObject>();
	ColoredObject[] coloredObjectsAlt2 = null;
	
	void AddNewObject()
	{
		//create new object
		ColoredObject newColoredObject = Instantiate(coloredObjectBlueprint);
		newColoredObject.color = 1; //initialize new obj

		//update list of objects alternative 1
		coloredObjectsAlt1.Add(newColoredObject);

		//update list of objects alternative 2
		coloredObjectsAlt2 = GameObject.FindObjectsOfType<ColoredObject>();
	}
	
	void Update()
	{
		//using alternative 1
		for (int i=0; i<coloredObjectsAlt1.Count; i++)
		{
			if(coloredObjectsAlt1_.placedOnPedistal && coloredObjectsAlt1*.color == 1)*_

* {*
* //do something*
* }*
* }*

* //using alternative 2*
* if(coloredObjectsAlt2 != null) {*
* for (int i=0; i<coloredObjectsAlt2.Length; i++)*
* {*
if(coloredObjectsAlt2_.placedOnPedistal && coloredObjectsAlt2*.color == 1)
{
//do something*

* }
}
}
}
}*_

you can basicaly reference your gameobjects in this case the “coloured objects”, for example
public gameObject coloredObject1;

then be sure to drag and drop it in the inspector!
after that you can simply
access everything on that script which is public
like (i have stored the result in a bool called isGreen, you can even access int, float etc if you want)
coloredObject1.GetComponent().YourBool;

then if its a bool you can check

if(isGreen && isBlue && isRed){
whatever you want to do
}

(Note you can access other scripts by making more gameobjects like the coloredObject1)