how to make sure that a collision is just with the main object and not the child

i’m making a game and I want to make it so that the child defeats enemys on collision. but when it hits the parent the player loses hp

Thank you

The problem is that the parent would take damage while the child would do damage. Thats technically not a problem. If your child object is at another position than the parent, its not a problem at all. But if they have the same position you should have some way to activate/deactivate the hitbox of the child.