This is a pretty long script since it contains basically my entire game. It works nicely, but when the round ends, the script does not reset, instead, it just stays there forever, nothing will ever happen after the first round is complete. How can I make this loop after it has finished? The functions have been shortened because I don't think they are important and it's too long.
local gamefolder = game.ServerStorage.GameSystem
local gamefolderc = game.ReplicatedStorage.GameSystemClient
local status = gamefolder.Status
local timer = gamefolder.Timer
local inround = game.ReplicatedStorage.InRound
local teams = game.Teams
local teamnames = gamefolder.Teams
local points = gamefolder.Scores
--// Game Settings
local max
local length
local countdown
local intermission
--// Game Systems
while true do
countdown = 15
intermission = 20
gamefolder.Map.Value = ""
gamefolderc.Map.Value = ""
gamefolder.GamemodeName.Value = ""
gamefolderc.GamemodeName.Value = ""
gamefolder.MaxPoints.Value = 0
print("Intermission")
for i = intermission, 1,-1 do
status.Value = "Intermission"
gamefolderc.Status.Value = "Intermission"
inround.Value = false
timer.Value = i
wait(1)
end
game.Workspace.WorkspaceScripts.PlayerPoints.Disabled = false
print("Loading Map")
status.Value = "Loading Map..."
gamefolderc.Status.Value = "Loading Map..."
timer.Value = 0
gamefolder.Map.Value = "Power Plant"
gamefolderc.Map.Value = "Power Plant"
for k, v in ipairs(gamefolder.Maps["Power Plant"]:GetChildren()) do
v:Clone().Parent = workspace.CurrentMap
wait(0.000000001)
end
local teamA = math.random(1,3)
local teamB = math.random(4,6)
print(teamA)
print(teamB)
teams.TeamA.Name = teamnames.A:FindFirstChild(teamA).Value
teams.TeamB.Name = teamnames.B:FindFirstChild(teamB).Value
points.T1.Name = teamnames.A:FindFirstChild(teamA).Value
points.T2.Name = teamnames.B:FindFirstChild(teamB).Value
local gamemodechooser = math.random(1,2)
print(gamemodechooser)
wait(1)
local function teamDeathMatch()
end
local function CTF()
end
if gamemodechooser == 1 then
spawn(CTF)
else if gamemodechooser == 2 then
spawn(CTF)
end
end
end

1 comment
Hello! Does it give an error when the script reaches the end?