Referencing a boolean from another script

Hello. I want to check if a boolean in another script is set to true. It should be easy but for some reason i am struggling.

I want a reference a boolean called “consoleActive” in a script called “consoleRange”

I i’m not sure if it’s important but the GameObject that my “consoleRange” script is attached to is called “consoleTexture”.

This was my attempt :

function Update () {

//new state attempt

	var consoleState: consoleRange = GetComponent(consoleRange); 



	if (consoleState.consoleActive == true) {
	
		Debug.Log("script working");
	
	}
}

Please give me a hand?

Almost everything there should be working, except for one thing- are the two scripts (being the one in your post, and the 'consoleRange' script) on the same object? GetComponent(Type) only returns other components on the same GameObject.

If you want to set up these things in the inspector, you can declare consoleState at the top of the script, and then you can drag that specific component onto your inspector (from a different object, or elsewhere in the hierarchy, for example).