The error I got was " ServerScriptService.GameLoop:76: Expected ‘end’ (to close ‘function’ at line 44), got ; did you forget to close ‘do’ at line 71?"
I dont know what is wrong with my code. Here it is btw
local redLightGreenLight = workspace["Red Light, Green Light"]
local status = game.ReplicatedStorage.Status
local intermission = 10
local gameDuration = 60
while true do
local IngamePlayers = {}
local gameEnded = false
while wait(1) do
status.Value = "Waiting for enough players. Hop on the pink circle to begin."
for _, player in pairs(game.Players:GetPlayers()) do
if player.Info:FindFirstChild("IsPlaying").Value == true and not table.find(IngamePlayers, player.Name) then
table.insert(IngamePlayers, player.Name)
end
end
if #IngamePlayers >= 1 then
break
end
end
-- choosing next game
status.Value = "Game starting..."
wait(2)
for i = intermission,0,-1 do
status.Value = "Teleporting in "..i.. " seconds"
wait(1)
end
status.Value = "Teleporting Players..."
wait(1)
for _, player in pairs(game.Players:GetPlayers()) do
if table.find(IngamePlayers, player.Name) and player.Info:FindFirstChild("IsPlaying").Value == true then
local randomSpawn = redLightGreenLight["Spawns"]:GetChildren()[math.random(1, #redLightGreenLight["Spawns"]:GetChildren())]
player.Character.HumanoidRootPart.CFrame = randomSpawn.CFrame
end
end
wait(2)
for i = 10,0, -1 do
status.Value = "Starting in " ..i
wait(1)
end
status.Value = "Go!"
wait(1)
spawn(function()
while true do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Visible = true
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
end
while not gameEnded do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Red Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.RedLightColor.Value
end
end
wait(math.random(1,6))
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
wait(.1)
end
end
for i = gameDuration,0,-1 do
status.Value = i.. " seconds remaining"
wait(1)
end
gameEnded = true
end
local redLightGreenLight = workspace["Red Light, Green Light"]
local status = game.ReplicatedStorage.Status
local intermission = 10
local gameDuration = 60
while true do
local IngamePlayers = {}
local gameEnded = false
while wait(1) do
status.Value = "Waiting for enough players. Hop on the pink circle to begin."
for _, player in pairs(game.Players:GetPlayers()) do
if player.Info:FindFirstChild("IsPlaying").Value == true and not table.find(IngamePlayers, player.Name) then
table.insert(IngamePlayers, player.Name)
end
end
if #IngamePlayers >= 1 then
break
end
end
-- choosing next game
status.Value = "Game starting..."
wait(2)
for i = intermission,0,-1 do
status.Value = "Teleporting in "..i.. " seconds"
wait(1)
end
status.Value = "Teleporting Players..."
wait(1)
for _, player in pairs(game.Players:GetPlayers()) do
if table.find(IngamePlayers, player.Name) and player.Info:FindFirstChild("IsPlaying").Value == true then
local randomSpawn = redLightGreenLight["Spawns"]:GetChildren()[math.random(1, #redLightGreenLight["Spawns"]:GetChildren())]
player.Character.HumanoidRootPart.CFrame = randomSpawn.CFrame
end
end
wait(2)
for i = 10,0, -1 do
status.Value = "Starting in " ..i
wait(1)
end
status.Value = "Go!"
wait(1)
spawn(function()
while true do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Visible = true
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
end
while not gameEnded do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Red Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.RedLightColor.Value
end
end
wait(math.random(1,6))
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
wait(.1)
end
end
for i = gameDuration,0,-1 do
status.Value = i.. " seconds remaining"
wait(1)
end
gameEnded = true
end
end)
end
local redLightGreenLight = workspace["Red Light, Green Light"]
local status = game.ReplicatedStorage.Status
local intermission = 10
local gameDuration = 60
while true do
local IngamePlayers = {}
local gameEnded = false
while wait(1) do
status.Value = "Waiting for enough players. Hop on the pink circle to begin."
for _, player in pairs(game.Players:GetPlayers()) do
if player.Info:FindFirstChild("IsPlaying").Value == true and not table.find(IngamePlayers, player.Name) then
table.insert(IngamePlayers, player.Name)
end
end
if #IngamePlayers >= 1 then
break
end
end
-- choosing next game
status.Value = "Game starting..."
wait(2)
for i = intermission,0,-1 do
status.Value = "Teleporting in "..i.. " seconds"
wait(1)
end
status.Value = "Teleporting Players..."
wait(1)
for _, player in pairs(game.Players:GetPlayers()) do
if table.find(IngamePlayers, player.Name) and player.Info:FindFirstChild("IsPlaying").Value == true then
local randomSpawn = redLightGreenLight["Spawns"]:GetChildren()[math.random(1, #redLightGreenLight["Spawns"]:GetChildren())]
player.Character.HumanoidRootPart.CFrame = randomSpawn.CFrame
end
end
wait(2)
for i = 10,0, -1 do
status.Value = "Starting in " ..i
wait(1)
end
status.Value = "Go!"
wait(1)
spawn(function()
while true do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Visible = true
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
end
while not gameEnded do
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Red Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.RedLightColor.Value
end
end
wait(math.random(1,6))
for i, v in pairs(game.Players:GetPlayers()) do
if v.Info:FindFirstChild("IsPlaying").Value == true then
v.PlayerGui.Main.LightColor.Text = "Green Light"
v.PlayerGui.Main.LightColor.TextColor3 = v.PlayerGui.Main.LightColor.GreenLightColor.Value
end
wait(.1)
end
end
for i = gameDuration,0,-1 do
status.Value = i.. " seconds remaining"
wait(1)
end
gameEnded = true
end
end) --- Missing
end -- Missing