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

Is there a way to respawn a player without killing them?

I want a way to quickly and easily respawn players, without messing with their KDR. Is there a function to do this, or should I just use CFrame?

2 answers

✓ Accepted answer

Yes, there is a really simple way to do so. Sadly, it only works through server scripts. There is a function of the player, called LoadCharacter

Example:

-- server script
Player:LoadCharacter()

That's pretty much it.

2 comments

0

Thanks for the answer! You mentioned that using "Player:LoadCharacter" would only work in a server script. Do you mean a script running in ServerScriptService, or just a regular script as opposed to LocalScript?

0

Any script that isn't a LocalScript.

yes, there is! you will need a GUI! If the player pressed the button they will respawn (with killing) and then dicrease the Death or WOs value by 1!

else you have to use a CFrame

okay, here is the script (please make a Gui for that)

Button = script.Parent              --insert the Button in the Menu inside the screenGui which parent is StarterGui (put the script in here)
Menu = script.Parent.Parent   --insert the Menu in a ScreenGui


Button.MouseButton1Down:connect(function()
	script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
	script.Parent.Parent.Parent.Parent.Parent.leaderstats.Deaths.Value = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Deaths.Value - 1
end)

Change Deaths to WOs if you want!

script.Parent.Parent.Parent.Parent.Parent this let the script (just a normal script) look to game.Players.LocalPlayer

game.Players.LocalPlayers can only be used in a "LocalScript" But many people like normal scripts most..

If you want to use a CFrame use this: btw, I didn't tested this but just typed it in here, if it doesn't work please tell me :( don't give me a -1

local Spawn = game.Workspace.SpawnBrick --Edit to your spawn!
Button = script.Parent              --insert the Button in the Menu inside the screenGui which parent is StarterGui (put the script in here)
Menu = script.Parent.Parent   --insert the Menu in a ScreenGui

Button.MouseButton1Down:connect(function()
	script.Parent.Parent.Parent.Parent.Parent.Character.Position = CFrame.new(Spawn.Postition)
end)

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