Where do I put this code?

I have been googling for solutions to problems I have been having, and I do find code.
However nothing in my scripts ever work. I add a script to an object, put code in it (usually trying to make something happen upon collision) and I can’t get it to do ANYTHING. I have searched online for a good book that I could use, but only get tutorials that I have the same issues with. (nothing works in any tutorial)

I have placed the following code in a custom script for the player, and I tried putting it in the custom script attached to the entity I want to check a collision with. I even tried putting it in the script that moves the player. Nothing ever happens.

function OnCollision ( collision : Collision)
{
print("The variable is :" + collision);
    if (collision.gameObject.name == "TimeEntity")
    {
        Destroy (collision.gameObject);
       }
}

I think you should use OnCollisionEnter.