Trying to "link" two scripts

I’m having problems trying to get a pause menu working on my FPC (First Person Controller), I have a script that enables and disables it when a key is pressed (escape). However, it seems that when i press the key, it doesn’t enable it at the “Start” of the game.

PauseMenuEnabler (Javascript)

var PauseScript1 : PauseMenu;
    
    function Start () {
    
    PauseScript1 = GetComponent("PauseMenu");
    
    PauseScript1.enabled = false;
    Screen.lockCursor = true;
    }
    
    
    function Update () {
    
    PauseScript1 = GetComponent("PauseMenu");
    
    	if(Input.GetKeyDown("escape")) {
    	PauseScript1.enabled = true;
    	
    	}
    }

var PauseScript1 : PauseMenu; //Asumes the other script is named PauseMenu

    function Start () {
     
    PauseScript1 = GetComponent(PauseMenu); //No need for quotes, just give it the type
     
    PauseScript1.enabled = false;
    Screen.lockCursor = true;
    }
     
     
    function Update () {
     
  // remove  PauseScript1 = GetComponent("PauseMenu"); This is already done in start, and thePauseScript1 is global within this script
     
    if(Input.GetKeyDown("escape")) {
    PauseScript1.enabled = true;
     
    }
    } 

This is easier than I first thought as well :slight_smile: