Disabling Scripts

I am trying to disable a script that opens a door so the only way that it could be open is by destroying turrets because the turrets have the disabling code. When the turrets are gone the door can open. But nothing I do seems to work. Then I have tried to make it were the door can sense the Game Objects but I don’t know were to start.I am deeply frustrated and desperately need help. Can someone please help me by giving me a script (Preferably in JavaScript but I wont complain) similar to what I have been trying to do?

The Door Script works. Here is my code for the door opening


And here is the code that disables it.


It keeps saying not refrence to an gameobject or something. Please Please Please Help I need this for my Finals.

You did not post the entire error. I guess DoorController is not attached to whatever game object gameObject is referencing. Or gameObject itself isn’t set if you declared it yourself.