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

How to make a script fire everytime a player dies?

game.Players.PlayerAdded:Connect(function(player)
	local plrname = player.Name
	local humanoid = game.Workspace:WaitForChild(plrname)
	local hum = humanoid:WaitForChild("Humanoid")

	local function onCharacterAdded(character)
	end
	
	player.CharacterAdded:Connect(onCharacterAdded)

        if player.Character then
      
        -- my code --

         end
end)

I tried using this but it only works once

1 answer

Do this:

player.Character.Humanoid.Died:Connect(function)
--Blahblah blah
end)

You can search in the wiki for that for more info.

1 comment

0

aight tar

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