Accessing a boolean from another script with GetComponent (USING C#!)

I need this ASAP. Just can’t find over the entire internet a solution for this. I’m kinda new using Unity but I would really appreciate if someone answer my question the way I want, not suggesting other stuff instead.

Just if there is no way of accessing a boolean value from another script WITH GetComponent I would like to know other solutions.

Thank you!

So you have a script on one object called

public class ThisHasABoolean : MonoBehavioiur
    public bool onOrOff;

Then in your other script, you have a reference to the gameObject that first script is attached to, and you use

otherObject.GetComponent<ThisHasABoolean>().onOrOff = true;

This sets the other boolean to true!