If I Like Restart Sometimes: The Command Just Loops or Maps Don't Load?
I'm Having A Different Problem Everytime I Reset Server, Help Please. Have I Done Something Wrong with End statments?
local s = script.Stat --------------------------------------- ---------------INTERMISSION----------------------- t = 0 while true do t= 8 repeat t= t-1 s.Value = "Next Game Starting in "..t wait(1) until t == 0 -------------------- TELEPORT THEM TO GAME------------ game.Workspace.Gravity = 30 local Maps = {'Forest','Lava','ToxicGas','Laser','Ice'} local randomMap = math.random(1, #Maps) for i,v in pairs(Maps) do if randomMap == i then local storage = game:GetService("ReplicatedStorage") local map = storage.Maps:WaitForChild(v):Clone() map.Parent = workspace.MapPlaying wait(1) target = CFrame.new(137, 190.5, 188) for i, player in pairs(game.Players:GetChildren()) do player.Character.UpperTorso.CFrame = target end end ------------------------------------------- t = 5 repeat t= t-1 s.Value = "Dropping Down In "..t wait(1) until t == 0 game.Workspace.Game.Roof.CanCollide = false game.Workspace.Game.Roof.Transparency = 1 end t = 10 repeat t= t-1 s.Value = t.." Seconds Left To Complete Level" wait(1) until t == 0 target = CFrame.new(-250, 2.19, 158) for i, player in pairs(game.Players:GetChildren()) do player.Character.UpperTorso.CFrame = target --add an offset of 5 for each character end game.Workspace.Gravity = 180 game.Workspace.MapPlaying:ClearAllChildren() --------------------- Teleport Players To LOBBY------------- game.Workspace.Game.Roof.CanCollide = true game.Workspace.Game.Roof.Transparency = 0.6 wait(1) s.Value = "Game Ended" end ---------------- RESTORE------------------ wait(4)
Hey, ItzJester2. I tested out your script and it seems like your "Dropping down" repeat loop keeps repeating regardless of correct logic. Instead I replaced it with a simple for loop, which made it work and not repeat anymore. Also, YES. You did mess up the ends and I corrected that. Just copy this script down below and replace it with your old one
Make sure to upvote and accept this answer. Thanks!
local s = script.Stat --------------------------------------- ---------------INTERMISSION----------------------- t = 0 while true do t= 8 repeat t= t-1 s.Value = "Next Game Starting in "..t wait(1) print(t) until t == 0 -------------------- TELEPORT THEM TO GAME------------ game.Workspace.Gravity = 30 local Maps = {'Forest','Lava','ToxicGas','Laser','Ice'} local randomMap = math.random(1, #Maps) for i,v in pairs(Maps) do if randomMap == i then local storage = game:GetService("ReplicatedStorage") local map = storage.Maps:WaitForChild(v):Clone() map.Parent = workspace.MapPlaying end end wait(1) target = CFrame.new(137, 190.5, 188) for i, player in pairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target end ------------------------------------------- t = 5 for i = 5, 1, -1 do t = t - 1 s.Value = "Dropping Down In " .. t wait(1) end game.Workspace.Game.Roof.CanCollide = false game.Workspace.Game.Roof.Transparency = 1 t = 10 repeat t= t-1 s.Value = t.." Seconds Left To Complete Level" wait(1) until t == 0 target = CFrame.new(-250, 2.19, 158) for i, player in pairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target --add an offset of 5 for each character end game.Workspace.Gravity = 180 game.Workspace.MapPlaying:ClearAllChildren() --------------------- Teleport Players To LOBBY------------- game.Workspace.Game.Roof.CanCollide = true game.Workspace.Game.Roof.Transparency = 0.6 wait(1) s.Value = "Game Ended" end ---------------- RESTORE------------------ wait(4)