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

[SOLVED] How to force respawn a player if they get removed?

Can someone help me figure out how to force respawn a player if I removed them?

So basically this script removes the player:


local Player = game.Players.LocalPlayer.Character
function onButtonClicked()
	game.Players.CharacterAutoLoads = false
	Player.Humanoid.Health = 0
	script.Parent.Parent.Parent.MenuButton.Visible = false
	script.Parent.Parent.Parent.Menu.Visible = true
	Player.Humanoid.Died:Connect(function()
		Player:Remove()
	end)
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

and I'm trying to figure out if a player presses play, it respawns them

local Player = game.Players.LocalPlayer.Character
function onButtonClicked()
	game.Players.CharacterAutoLoads = true
	script.Parent.Parent.Parent.MenuButton.Visible = true
	script.Parent.Parent.Parent.Menu.Visible = false
	
script.Parent.MouseButton1Click:connect(onButtonClicked)

1 answer

I just figured it out, I'm so dumb.

Player:LoadCharacter()

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