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

Killing the player ONCE when they join?

This code keeps killing the player over and over. I just want it to kill the player ONE time when they join.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character.Humanoid.Health = 0
	end)
end

1 answer

✓ Accepted answer

It's simple. While CharacterAdded fires each time they respawn, PlayerAdded only fires when they join. Therefore, just remove the CharacterAdded event. You will, of course, have to make sure the necessary objects are loaded before you manipulate them.

game.Players.PlayerAdded:connect(function(plr)
	repeat wait() until plr.Character --wait until they load
	plr.Character:WaitForChild("Humanoid").Health = 0
end)

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