script read from anther

i have two scripts one of them have an important variable so i want to read this variiable from my script to check it with if and i avoid makeing the code more complicated by make them one code i hopen i have explianed well thanks in advance

Have you looked at GameObject.GetComponent here’s more information on the script reference:

just use get component like you would with a rigid body or something, but get your script on which ever object it is on and call the varible