Why is this script now working?

This is really getting on my nerves. I can’t figure out where the problem is! It’s supposed to destroy a coin when the player collides with it but it doesn’t, the player collides with it and nothing happens (The coin is still there).

#pragma strict

var player : Transform;

function Start (){

}

function Update () {

}

function OnCollisionEnter(collision : Collision)
{
if(collision.transform == player);
{
Destroy(gameObject);
}
}

Try:

#pragma strict
 
var player : Transform;
 
function Start (){
 
}
 
function Update () {
 
}
 
function OnTriggerEnter(collision : Collider){
    if(collision.name == "Player"){
        Destroy(gameObject);
    }
}