Humanoid.Died not triggering

When i kill someone with my knife, the knife uses humanoid:TakeDamage(100) on the target but for some reason it isnt triggering Humanoid.Died and so my code isnt respawning the player.


If anyone knows what is causing this issue please lmk.

1 Like

Try using Humanoid.Health = 0.

I added Humanoid.Health = 0 and it still doesnt fix the issue.

What is this for a script, where is it located and are you sure that the function got fired? Also, set a print maybe before the .Died:Wait() and see if the script even runs there. Another thing you could try is setting the Health in the Test Mode from the Server to 0

i know that the Death event is getting connected as this line is getting ran.
image

1 Like

My assumption is that the function :ApplySide(Character) is what kills the Humanoid.
After the Humanoid died, you then proceed to schedule a :Wait() on the .Died event, which already passed.


You should make the connection to the Humanoid.Died event before you run the function to make sure it is ready for when the character dies in the function.

Where are you defining self? Shouldn’t it just be Player:LoadCharacter()?

:ApplySide simply creates a model of the knife and attaches it to the side of the players leg. the code that kills them is completely separate from this script


self is referencing CharacterManager, the CharacterManager:LoadCharacter function just loads the player with their equiped Character if they have one.

1 Like

I see that you are using CharacterManager for this. I would suggest to add a print statement after the wait to see if the fault is in the event or the character manager. I would also suggest using task.wait(4) as wait() is going to become deprecated soon enough.

I think i fixed it by changing the humanoid state to Dead. Im pretty sure that the reason this was happening is because my Ragdoll script was changing the humanoid state to Physics before the game had a chance to realise that the player died.

I see. Well you could also do one more thing. You could use;

humanoid.HealthChanged:Connect(function(currentHealth)
    if currentHealth <= 0 then
        task.wait(4)
        self:LoadCharacter()
    end
end)

This way you can keep your humanoid’s state while also detecting the death of the humanoid.

Thanks. I didnt think to just check the Health on the CharacterManager. i will defo add this to the module.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.