How do I get the specific character in a glory kill system?

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.


So I’m kinda stuck. Please help.

Is the enemy players or AI?

AI, its singleplayer. Sorry I forgot to mention it.

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

I’m kinda lost. How do I add the “tag?” How do I even get it? Sorry, I’m not very experienced. Its my first time on here lol. They’re also AI.

do the ai have a character, and how does the ai take damage

The AI has a character. I’m assuming what you mean by character is a rig. The AI Takes Damage from a gun.

You could use

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.

1 Like

Wont that repeat a single time? Should I do the Hum.HealthChanged Event? Or should I put it in a while loop?