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

How do I make a player die once when they join?

I am trying to make an obby that autosaves on Roblox, I have a script that makes it autosave. For some reason, once in a while that script will spawn you at level 1 rather than on your current level. To fix this you need to reset character (then it tp's you to your correct level). I am trying to make a script that will just auto kill you so that you don't need to reset. Anybody know how? Currently I have this, but it doesn't work properly:

game.Players.PlayerAdded:connect(function(player) --waits for player player.CharacterAdded:connect(function(char) wait() --waits to kill char:WaitForChild("ForceField"):Destroy()--destroys force field char:WaitForChild("Humanoid").Health=0 --sets health to 0 end) end)

1 answer

✓ Accepted answer

Try this, and please use CodeBlocks when putting code. And if you want to know, press view source to the right of this post to see the source.

game.Players.PlayerAdded:Connect(function(plr)
       plr.CharacterAdded:Wait() -- wait for the player to spawn character
        wait(0.1)
       plr:LoadCharacter() -- rather than killing player, reload the character to respawn the player.
end)

If this works for you, please mark this as a solution.

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