Please help with GUItext

So im reading this book Unity 3.x Development Essentials. And im stuck.
Right now im working on GUIText. And im trying to change it. When i come to the closed door the message shows up “Damn it! It’s locked… Maybe that generator needs power”

and after when i pick up first power cell and come back to the door it should show “This door won’t budge…guess it needs fully charging- maybe more power cells will help…”

I checked my script many times and could not find anything. Plz help thanks.

using UnityEngine;
using System.Collections;

public class TriggerZone : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}

	// Update is called once per frame
	void Update () {
	
	}
	public AudioClip lockedSound;
	public GUIText textHints;
	public Light doorLight;
	
	void OnTriggerEnter(Collider col){
		if(col.gameObject.tag=="Player"){
			if(Inventory.charge==4){
		transform.FindChild("door").SendMessage("DoorCheck");
				if(GameObject.Find("PowerGUI")){
					Destroy (GameObject.Find("PowerGUI"));
					doorLight.color=Color.green;
					
					
				}
			else if(Inventory.charge > 0 && Inventory.charge < 4){
						textHints.SendMessage("ShowHint",
						"This door won't budge..guess it needs fully charging- maybe more power cells will help...");
						transform.FindChild("door").audio.PlayOneShot(lockedSound);
				}
					
			}else{
				transform.FindChild("door").audio.PlayOneShot(lockedSound);
				col.gameObject.SendMessage("HUDon");
				textHints.SendMessage("ShowHint", "Damn it! It's locked.. Maybe that generator needs power");
				
	}
		}
	
}
}

Your GUIText object (textHints) needs a script on it (and it looks like that thing should be a globally accessible variable, not a local var on a door?). The script must have a function named ShowHint that takes a string as the parameter. The ShowHint function is what you need to check.

You could add Debug.Log(“Whatever”) statements to be sure the door is actually recognizing that it’s hit the player.

Is the book teaching you to use all these SendMessage calls? Blech. SendMessage is slow and -really- hard to debug. I hope it’s not telling you to use it all over the place.