Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Humanoid death check only running once?

Pretty simple premise here, this function is only running once. When I enter the game the first time my character dies it runs fine, but after another respawn it doesn't return anything. How could I make it run every time the character dies?

local player = game.Players.LocalPlayer
local character = player.CharacterAdded:wait()
character:WaitForChild("Humanoid").Died:connect(function()
	print("Player was killed")
end)

Any help would be greatly appreciated. It's probably a very simple solution I just couldn't see it.

2 answers

✓ Accepted answer

For me this works:

game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
	character:WaitForChild("Humanoid").Died:Connect(function()
		--The stuff you wanna do
	end)
end)

Hello I can help you with this, try using this:

while true do --This will look when the script is ended and then it will do the text below it
wait(0.1) --Use this to make sure it wont crash
game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
    character:WaitForChild("Humanoid").Died:Connect(function()
        --What you want to happen if they die (PUT ON THIS LINE!)
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.