NullReference on Collision

I’m trying to make that a text object will only be visible once the player collides with the NPC, but the console displays this error everytime the collision occurs:

NullReferenceException: Object reference not set to an instance of an object
NPCScript.OnTriggerEnter (UnityEngine.Collider talkTrigger) (at Assets/Scripts/NPCScript.js:14)

NullReferenceException: Object reference not set to an instance of an object
NPCScript+$OnTriggerExit$1+$.MoveNext () (at Assets/Scripts/NPCScript.js:20)

This is my code:

var dialogue : UnityEngine.UI.Text;
var talkTrigger : GameObject;

function Start () {
	talkTrigger = GameObject.Find("TalkTrigger");
	
	dialogue = GetComponent(UI.Text);
	dialogue.text = "Hello World";
	dialogue.enabled = false;
}

function OnTriggerEnter (talkTrigger : Collider){
	//if(Input.GetKeyDown("e"))
		dialogue.enabled = true;			

}

function OnTriggerExit (talkTrigger : Collider){
	yield WaitForSeconds(5);
	dialogue.enabled = true;
}

I’m not fluent in JavaScript but are you meant to pass through ‘talkTrigger’ through your OnCollision parameters like that? As far as I’m concerned, it’s being tiggered by other colliders, by any collider. You’d want to check that the Collider being passed through the parameter is your “Talk Trigger” object. Rather than writing OnTriggerEnter(talkTrigger : Collider), write OnTriggerEnter(col : Collider) and check that col.tag == “whatever talkTriggers tag is”.