Trigger collision with Player won't work

Hello! :smiley: Im Quite New Here but i’ve actually Started Scripting UnityScript! :smiley:
But there is a Problem with this script somehow. it won’t work! I have 1 Script that changes the GUI Text when The Player Collid with the “Box”. but somehow. It won’t work :frowning:

Any Ideas?

Script:

var targetGuiText : GUIText;

function OnControllerColliderHit(collision:Collision)
{
    if(collision.gameObject.tag == "Player")
    {
        targetGuiText.text = "A Way out!";
         yield WaitForSeconds(3);
         targetGuiText.text = "There must be a way out..";
         yield WaitForSeconds(3);
         targetGuiText.text = "But where?";
         yield WaitForSeconds(2);
         targetGuiText.text = "";
    }
}

Use OnCollisionEnter and try attach the script to the player.

I had a similar problem and it worked for me. :smiley:

function OnCollisionEnter(collision : Collision){

Your stuff here

}

Make sure you attach a collider/gravity ignoring rigidbody to the item colliding. Also, attach one to the other object. If you want to be able to go through the object but still say the things, change it to OnTriggerEnter and make sure the collider for that object is set to Trigger.