How to detect collisions in the children of a 2D object.

I am working on a 2D game and everything seems to be going great except for the health-bar. it works perfectly but it does not detect collisions in the objects. it goes something like this.

function OnCollisionEnter2D(coll: Collision2D) {
if (coll.gameObject.tag == “Enemy” && == false){
isHurtin = true;

it detects collisions with enemies, but it only works with colliders in the Player not any of its children. how could I fix my little problem?

You could try something like this

if ( ! && coll.transform.root.tag == "Enemy" ){ isHurtin = true; }