OnCollisionEnter2D not working?

Hello. I searched up OnCollisionEnter2D and used the code it was provided with. I modified the code into

#pragma strict

function OnCollisionEnter2D(coll: Collision2D) {
if (coll.gameObject.tag == “Player”)
Destroy(gameObject);
}

However, when the object collides with the Player it doesn’t do anything. What am I doing wrong? I am making the game in 2D. I am also very new to Scripting and game creation.

You have to destroy it like this

Destroy(coll.gameObject);

The “is trigger” on the objects collider should be unchecked, if it’s checked it won’t work.