Accessing Variable From Two Different Scripts

I want to take variable A from another script, see if A is already true, if A is true, make A false, then make B true.

there is 2 ways to do this. also next time need more detail for a batter answer :L

  1. you can make both of your needed variables " public static bool;" , this makes them accessible from across any script, so in your “another” script you would call “variableAScript.variableA”.
    (be careful as static means your variables that are static will stay the same and wont reset even if the scenes reset, it only changes when something calls on it to change it )

  2. you can reference both of your scripts to the “another” script and access the variables from that ( if the variables are public only, or a property is created for them, either way works ) to do this… on the “another” script you make a new variable like this " VariableAScriptName variableNameYouChoose;" then in “void Start()” “variableNameYouChoose = gameObject.GetComponent< variableNameYouChoose >();”
    This allows you to access the variable A from that script you referenced, do that by using “variableNameYouChoose.variableA”.