Humanoid.Died not working?

So I’m making a playable Charger from L4D and have it so that when he grabs you, he creates an attachment and puts it in your HumanoidRootPart. It then sets AlignPosition and AlignOrientation to the attachment. When he kills you, nothing happens and only .died works on local scripts. This then makes it so that the player is infinitely stuck unless the Charger dies or the attachment gets deleted. Is there a way to fix this? Here is what it appears like.

local dieconnection

local function onDeath()
    if humanoid.Health <= 0 and dieconnection then
        dieconnection:Disconnect()
        ReplicatedStorage.Remotes.KilledUI:FireAllClients(string.format("%s killed %s", zCharacter.Name, humanoid.Parent.Name))
        CleanUpEffects(character)
        local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
        player.CharacterAdded:Wait()
        humanoid = player.Character:WaitForChild("Humanoid")
        dieconnection = humanoid.Died(onDeath)
    end
end

dieconnection = humanoid.Died(onDeath)

I fixed it! I changed .Died to .HealthChanged since it only detects when health is at 0 or below and it works!
image

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