The following code should print "died!" when a player dies:
game.Players.PlayerAdded:Connect(function(client) repeat wait() until client.Character ~= nil and client.dead ~= nil client.Character.Humanoid.Died:Connect(function() client.dead.Value = true print("died!") print() end) end)
The problem is that "died!" does print when the player dies, but won't print if they die again, meaning it didn't detect their deaths after the 1st one. Anyone know the problem? Also, is there a better way to detect when players die?
You have it only set to when the player joins, not when the character loads in to. This isn't tested, but it should work.
game.Players.PlayerAdded:Connect(function(client) client.CharacterAdded:connect(function(Character) repeat wait() until client.Character ~= nil and client.dead ~= nil client.Character.Humanoid.Died:Connect(function() client.dead.Value = true print("died!") print() end) end)