Im trying to make it so when the playerchosen dies the whole script restarts, or if the player leaves, I ave tried and tried. Any Help?
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
wait(1)
end
wait(1)
mapchosenclone:remove()
else
h.Text = "There isnt enough players to start"
end
end

1 comment
this would work, You cant just have a script half through something stop. once there is more than 2 players and someone leaves halfway through, the lone player has to sit there and wait