So, I’ve been trying to make a glory kill system (like in doom). But, I don’t know how to get the specific humanoid of the enemy that has reached a certain amount of health. I can code the health thing, but, I cant get the specific humanoid in my scripts.
–Solution I tried.–
I tried using a for loop but that gets ALL of the the enemies.
whenever the enemy takes damage add a “tag” into their character and whenever the humanoid runs the “died” function look for that tag
these tags are usually called “creator” and its a object value with the value being the player who killed them. make sure to add the value to the debris so it deletes it soon after
local Hum = --- Path or sum
if Hum.Health <= 1 then
-- Glory kill animation then Humanoid.Health = 0 Which kills it
end
If you want to get the specific Enemy then you could see if you are moving your cursor over them or are near them like in doom or something. If you want to make a for loop put all enemys in a folder and you could loop then all through their at all times.