Body Parts Damage

Hello, i’ve been trying to create FPS with separate damage to body Parts. I’ve set up box collider on the head bones, and the body. So far I’ve been able to hit the head and body separately.

The problem is, where should i put the script to store the damage received for my enemy? Because if i put the script on the body, every time the ray cast hit the head collider, it won’t run the script to reduce the health (Which i put on the body). I could change the health variable to static, but i plan to have multiple enemy, and if i make them static, it will reduce all of the health from the enemy i didn’t even hit.

Is there anyway i can combine damage from body, head, foot etc into one enemy object? I want to use same script for all of my enemy, or do i need to create separate different script for each enemy?

thanks for the help.

What i will do is put the enemy with all its parts under one game object, write a script that will check the health of the enemy, lets say either check the parts with their names (as child objects) or tag them or if you want to make it even harder for you then attach another script on eveery part you want to take the damage on and make it talk to the script on the parent game object. Try these ways (if they make sense)