"Ghost" Humanoids. Humanoid not dying

I am stuck with this issue. I don’t think it’s a bug though.

So once any NPC/Humanoid has been removed of all of it’s health, sometimes, the humanoid keeps going.
As in, example: A zombie would still go after you even if you damage it all the way to zero.

Sometimes, even if I see the joints of a NPC break, they NPC is still there and somehow “Alive”.

RemoteEvents seems to be the fix but I have no clue from which direction I should do it.

Humanoid is in workspace. Even with a healthbar down to zero it’s still up and going.

1 Like

Why don’t you try adding a:

if Zombie.Humanoid.Health > 0 then
    --do stuff
end

A small workaround that should help fix your problem. You can also use a variable, and if that variable is true then the NPC will keep going, else the NPC will stop “working”. You can do that with Humanoid.Died

3 Likes

How are players dealing damage to the NPCs? Is it happening from a localscript?

1 Like

As @Blokav is suggesting, the NPCs might be dying only on your client and not the server—you should check whatever script contains the relevant code and go from there

I would also caution against this as exploiters can fire the event themselves if it’s sent through a localscript (which is where the damage function may be located if you’re having this issue)

1 Like

Exactly. An important thing to do when working with remotes is called sanity checks - basically limiting how much control the player has over the weapon’s damage.

So instead of the weapon script firing a remote saying Take *this* much damage from *this* player., the signal should be more along the lines of I'm firing a bullet from *this* position in *this* direction. Then the server would have the authority to determine if the parameters are valid, whether a player/NPC was hit, and apply damage accordingly.

2 Likes

It is indeed from local scripts.

I don’t have much worry for exploiters, I build places and make games mainly just for myself and close friends.

Seems like it’s doing it. Thanks a lot.

1 Like