Same script activating separately on different game objects?

I have a script that activates once the player touches the NPC and presses space to start the dialogue and then press enter to move onto the next slide. But if there are two NPCs in the same scene, their scripts will interfere with each other, causing the wrong name and dialogue to appear. How do I make it so that only one script at a time will be activated when the player is talking to them?

 public void Update()
    {
        //Talking to the NPC
        if (Input.GetKeyDown("space"))
        {
            //Begin dialogue
            if (touch == true)
            {
                    dialogue.SetActive(true);
                    trigger.TriggerDialogue();
 	       }
    	}

        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (touch == true)
            {
                //Clicking the next dialogue panel
                start.DisplayNextSentence();
            }
    	}
    }

I cant believe no one answered this yet this is so sad I know a lot of people who have this issue