Enable / Disable Scripts of another Objects

How do i Enable / Disable Scripts of another Objects. I tried it with GameObject.Find("Object").GetComponent(Script).enabled = true;
but Unity gives me an error :
‘enabled’ is not an member of ‘UnityEngine.GetComponent’
I googled serveral times how to do it. But i never found a solution that Worked. And the solutions were old. (2010-2013)
Please Help.

Try making a variable for the object instead of finding it so it would me like


var Object1 : GameObject;

Object1.GetComponent(ScriptName).enabled = true;


Public GameObject Object1;
 Object1.GetComponent<ScriptName>.enabled = true;

don’t forget to assign the object that has the script you want to enable/disable in the inspector

note: not sure if c# will work I use JavaScript

tell me how it went with you

If you want find gameobject with tag write this

GameObject.FindGameObjectWithTag("TagName").GetComponent(ScriptName).enabled = false;