Hi I am trying to script a game script and it is going to countdown from 10 in the game then teleport all players to the lobby. Then have a countdown for the intermission then teleport back into the game. The part that is not working is my intermission time. can you please help me?
local h = Instance.new("Hint", workspace) while true do for g = 10, 0, -1 do h.Text = "There is " ..g.. " seconds left" wait(1) end for i, v in pairs(game.Players:GetPlayers()) do v.Character:MoveTo(workspace.lobby.Position) print("Players teleported!") end wait(1) for t = 10, 1, -1 do h.Text = "Intermission " ..t wait(1) for i, v in pairs (game.Players:GetPlayers()) do v.Character:Moveto(workspace.SpeedBrick.Position) print("Game started") end end end
What I think is happening is that you are teleporting the people 10 times because the for loop loops over 10 times or until 10 -1 -1 -1 = 0.
local h = Instance.new("Hint", workspace) while true do for g = 10, 0, -1 do h.Text = "There is " ..g.. " seconds left" wait(1) end for i, v in pairs(game.Players:GetPlayers()) do v.Character:MoveTo(workspace.lobby.Position) print("Players teleported!") end wait(1) for t = 10, 1, -1 do h.Text = "Intermission " ..t wait(1) end for i, v in pairs (game.Players:GetPlayers()) do v.Character:Moveto(workspace.SpeedBrick.Position) print("Game started") end end