Using OnTriggerEnter to trigger GUI text change.

I have an empty game object with a box collider and the following script attached to stop the end of a race.

 endGame.js

function OnTriggerEnter (EndGame : Collider) {
	
	HighScore.finished = HighScore.finished + 1;
		
	playerCars = FindObjectsOfType (PlayerCar);
	for (var car : PlayerCar in playerCars)
	car.enabled = false;
}

I have a GUI text with the following script attached to display “Cleared!” and the race stats.

HighScore.js

static var finished : int;

finished = 1;

if (finished == 2)
{
		guiText.text = "Cleared!";
		yield WaitForSeconds (2);
	
		guiText.text = "High Scores \n" + "Points collected: " + Points.points + "\nBombs hit: " + Bombs.bombsHit + "\nTime completed: " + "temp";
		yield WaitForSeconds (10);
}

Entering the trigger stops the playerCar as desired but does not seem to display the GUIText as desired. If i manually put in finished = 2, the GUIText displays the stats. What am I doing wrong?

What function is the second chunk of code in?

The second script is attached to a GUIText object.

Any ideas on what I’m doing wrong here?