Player wont destroy on collide with enemy (2D)

Hey, I’m trying to make it so when the enemy hits the player, the player’s gameObject will be destroyed

I currently have this:

 void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag== "Enemy")
        {
            Destroy(gameObject);
        }
    }

Your code should work as expected, as long as the script is attached to the player gameobject, and the player gameobject has a Collider2D and a RigidBody2D attached.