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

I need help with restarting script?

Asked by 9 years ago

Im trying to make it so if the playerchosen leaves or dies then the script will restart. Any help on this?

h = Instance.new("Hint",game.Workspace) maps = game.Lighting.Maps:GetChildren() players = game.Players:GetPlayers() winner = game.Workspace.winner

while true do wait(1) if #players >1 then h.Text = "Choosing the map.." wait(3) mapchoosing = math.random(1,#maps) mapchoosen = maps[mapchoosing] h.Text = "The map is named"..mapchoosen.Name mapchosenclone = mapchoosen:clone() mapchosenclone.Parent = game.Workspace wait(1) h.Text = "Choosing the player" wait(5) randplayer = math.random(1,#players) playerchosen = players[randplayer] h.Text = "The name of the player is" ..playerchosen.Name wait(1) playerchosen.Character.Torso.CFrame = CFrame.new(Vector3.new(43.088, 26.76, -333.25)) for t = 30,1,-1 do h.Text = "Time left"..t wait(1) end mapchosenclone:remove() else h.Text = "There isnt enough players to start"

end

end

Answer this question