Changing a bool on only 1 instance of a prefab instead of all?

So I am creating this little weapon shop that just spawns a prefab’d gun when you buy it, which then you can go up to it and equip it. The problem I am having is I have it so that way the weapon only shoots if you have it in your hand, which is controlled by a bool. The issue I have is when there are 2 instances of one weapon in the scene, which, when I equip one gun, it changes the bool for both, making it so the weapon can’t shoot. I was wondering what I would have to do to specify that only the bool for the specific instance is to be changed?

Sounds like you are trying to manage 2 guns from one script instance.

The script that controls the gun should be on the gun and should not use static variables and function for controlling the gun.
That way if you have 2 instances of the gun you will have a script instance for every gun object.

I imagine you use GameObject.FindObjectsWithTag which gives you an array of all objects with that tag. You need to target the gameObject directly (which means “Instance”). You can keep a variable of instantiated gameObject like: GameObject go = Instantialte(...) as GameObject;

If not, then i think your script has static variables and attached to prefab. Static methods/variables/fields etc. belongs to class itself, not the instance of object. So when you do something with a static method/variable/field, then you do that for all the instances of objects that has the class. Try using local fields and methods, then call them from scripts like:

GameObject go = (target gameObject)
go.GetComponent<TypeOfScript>().MethodName();

go.Getcomponent<TypeOfScript>().field = newValue;