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)

8 comments

0

what I meant is that when I click the rebirth button, it will respawn the player, not when they died

0

^ Yeah, use the LoadCharacter() function on the player. It’ll respawn them.

0

How, where to place it? Write a answer

0

^ Probably after line 5 after the player receives his/her rebirth.

0

still does not work

0

LoadCharacter is server side only

0

while how can I do it tho? what should I put or do?