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

How do you write a character respawn script? What do I write?

Asked by 5 years ago

I was trying to do a rebirth Gui, and want the players to respawn after they rebirth. How can I do that?

[It's a Local Script]

local stats = game.Players.LocalPlayer.leaderstats
script.Parent.MouseButton1Click:connect(function()
    if stats.LifeFormFound.Value >= 10 then
        game.Players.LocalPlayer.leaderstats.LifeFormFound.Value = 0
        game.Players.LocalPlayer.leaderstats.Rebirth.Value = game.Players.LocalPlayer.leaderstats.Rebirth.Value +1
    else
        game.Players.LocalPlayer.leaderstats.LifeFormFound.Value = game.Players.LocalPlayer.leaderstats.LifeFormFound.Value
        game.Players.LocalPlayer.PlayerGui.RebirthFail.Frame.Visible = true
        wait(3)
        game.Players.LocalPlayer.PlayerGui.RebirthFail.Frame.Visible = false
    end
end)
0
what I meant is that when I click the rebirth button, it will respawn the player, not when they died RainbowBeastYT 85 — 5y
0
^ Yeah, use the LoadCharacter() function on the player. It’ll respawn them. User#20279 0 — 5y
0
How, where to place it? Write a answer RainbowBeastYT 85 — 5y
View all comments (4 more)
0
^ Probably after line 5 after the player receives his/her rebirth. mudathir2007 157 — 5y
0
still does not work RainbowBeastYT 85 — 5y
0
LoadCharacter is server side only User#19524 175 — 5y
0
while how can I do it tho? what should I put or do? RainbowBeastYT 85 — 5y

Answer this question