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 respawn the player without adding up a death counter?

So I have a script for changing teams in a GUI, it looks like this.

function Click(mouse)
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Institutional white")

script.Parent.Parent.Parent:Destroy() --destroys the IntroGUI
local StarterGui = Game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled (Enum.CoreGuiType.PlayerList, true) --enables playerlist
StarterGui:SetCoreGuiEnabled (Enum.CoreGuiType.Backpack, true) --enabled backpack
game.Lighting.Blur.Size = 0 --disabled the blur
game.Players.LocalPlayer.Character.Humanoid.Health = 0 --kills player so they go to their spawn
end


script.Parent.MouseButton1Down:connect(Click)

Now it works fine but not perfect, such as, this game has a death counter and doing

game.Players.LocalPlayer.Character.Humanoid.Health = 0

of course kills them, adding up to the death counter, Ive tried

game.Players.LocalPlayer:LoadCharacter()

instead of

game.Players.LocalPlayer.Character.Humanoid.Health = 0

But it doesnt work in-game with Filtering Enabled.

1 answer

✓ Accepted answer

Here's a very simple solution... After you reset the character, make the death count's value 1 less... So if they had 2 deaths, and you reset them, the value would be 3, but you would subtract their deaths my 1... So you would still have 2 deaths, I have only tested this in studio, but it seems to work fine

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