Script help. How do i call this function.

I Got this script for a gui. I have script A

var Active : boolean = false;
    function Update ()
    {
        var Dissable_button : Dissable_button = GetComponent(Dissable_button);
        if (Input.GetKeyDown ("escape")){
        if (Active == false){       
        animation.Play ("A_in");
        Active = true;
        Screen.lockCursor = false;
           Dissable_button.Toggle(); //Acsesses script B's Function
    }
    }
    }
    function Close ()
    {
        animation.Play ("A_out");
        Active = false;
         Screen.lockCursor = true;
         Dissable_button.Toggle2(); //Acsesses script B's Function
    }

Then there is script B

private var button : UnityEngine.UI.Button;


    function Start ()
    {
        buttont = GetComponent(UnityEngine.UI.Button);
    }
   
    function Toggle () // The function script A is calling
    {
        button.enabled = !button.enabled;
         print("Toggled!");
    }
    function Toggle2 () // The function script A is calling
    {
        button.enabled = !button.enabled;
         print("Toggled!");
    }

The to scripts are in two different objects. Script a is calling function’s in script B.
Why is it not working.

When you use ‘GetComponent(Dissable_button)’ that would only work if both components were in the same object. If script B is in a different object you would need to do something like this in Script A:

var Dissable_button : Dissable_button = ObjectB.GetComponent(Dissable_button);

‘ObjectB’ would be a GameObject in Script A that you would set to point to the object that contains Script B.

The object script B is in is a child of a child.
How do I fix that.

transform.GetChild(child_number).GetComponent

Were do I put this?

In @tonemcbride 's example, replace ObjectB.GetComponent with transform.GetChild(0).GetComponent();

Looks like your script name is Dissable_button so GetComponent<Dissable_button>

Ok here is want the script A looks like

var Active : boolean = false;
    function Update ()
    {
        var Dissable_button : Dissable_button = transform.GetChild(2).GetComponent(Dissable_button)();

        if (Input.GetKeyDown ("escape")){
        if (Active == false){       
        animation.Play ("A_in");
        Active = true;
        Screen.lockCursor = false;
           Dissable_button.Toggle(); //Acsesses script B's Function
    }
    }
    }
    function Close ()
    {
        animation.Play ("A_out");
        Active = false;
         Screen.lockCursor = true;
         Dissable_button.Toggle2(); //Acsesses script B's Function
    }

Now I am getting the error | Assets/Pause_menu.js(4,91): BCE0077: It is not possible to invoke an expression of type ‘Dissable_button’

By the way, thanks for the help.

In C# the code wold be GetComponent(); but you’re in js so I think the code is GetComponent(script);

Looks like you can just remove the extra () from line 4 before the semicolon.