Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

This question has been solved by the original poster.

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

Log in to vote
0
Answered by 3 years ago

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

Player:LoadCharacter()
Ad

Answer this question