fixing bullet collision

so the code I have made for my bullet is meant to destroy itself when it hits the player but right now it only goes through. I’m confused since I have collisions on for both the bullet and the player.

This is the code for the bullet

// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D> ();
    target = GameObject.FindObjectOfType<Player>();
    moveDirection = (target.transform.position - transform.position).normalized * moveSpeed;
    rb.velocity = new Vector2 (moveDirection.x, moveDirection.y);
    Destroy (gameObject, 2f);
  
     }

void OnTriggerEnter2D (Collider2D col)
{
    if (col.gameObject.name.Equals ("Player")) {
        Debug.Log ("Hit!");
        Destroy (gameObject);
    }
}

}

Hi @ unity_2B61132535CD6D8497E6. Check if ur player is also a trigger and if so, uncheck IsTrigger. Also since you have used “col.gameObject.name.Equals” , make sure the Player spelling is correct. Also i dont see the reason why u have used Destroy in your start method if u are already destroying the bullet when it hits the player