C# script not working

I have a script that is suppose to display test on the screen and play an animation when the player walks through a box collider only it doesn’t work. When the player walks through the collider nothing is played. I have several other scripts that are almost identical to this and they all work perfectly so I don’t understand the problem.

This is the script…

using UnityEngine;
using System.Collections;

public class LightScene3 : MonoBehaviour {

	public int wait;
	public GUIStyle text;
	string message = " ";
	
	
	//GUI Box
	void OnGUI() {
		GUI.Label((new Rect(600,400,200,200)),message ,text);
	}
	
	//Displaying text
	IEnumerator OnTriggerEnter(Collider otherObjective){
		if (otherObjective.tag == "Player") {
			
			message = "Insert Text Here";
			GetComponent<UnityEngine.Animation> ().Play ("TeacherMonster");
			yield return new WaitForSeconds(wait);
			message = "Insert More Text Here";
			yield return new WaitForSeconds(wait);
		}
	}
}

AFAIK, the method declaration for OnTriggerEnter is a bit different from the one you have written like this:

IEnumerator OnTriggerEnter(Collider otherObjective){

You should try void instead of IEnumerator:

void OnTriggerEnter(Collider other) {
     // Your onTrigger logic here
}

Reference doc

Hope it helps!

OK. I solved the problem and realised that the collider was falling through the floor as it was attached to an object that was falling through the floor. Silly me!

Please could a moderator delete this question. Thank you!