local allWinners = game.Teams.game:GetChildren()
for i = 1, #allWinners do
print(allWinners[i].Name)
allWinners[i].leaderstats.Wins.Value += 1
task.wait()
end
does not give any wins or error and prints nothing? (there are players in that team)
It does not fail to reach this as it does the next loop after:
wait(3)
local function start()
task.spawn(function()
if game.Workspace:FindFirstChild("Map") then
game.Workspace.Map:Destroy()
end
local MapClone = game.ReplicatedStorage.Storage.Map:Clone()
MapClone.Parent = workspace
wait(2)
local allPlayers = game.Players:GetChildren()
for i = 1, #allPlayers do
allPlayers[i].Team = game.Teams.game
allPlayers[i].Character.PrimaryPart.CFrame = MapClone.Spawns.Spawn.CFrame
end
game.Workspace.Time.Value.Value = 10
for i = 1,10 do
wait(1)
game.Workspace.Time.Value.Value -= 1
task.wait()
end
local allWinners = game.Teams.game:GetChildren()
for i = 1, #allWinners do
print(allWinners[i].Name)
allWinners[i].leaderstats.Wins.Value += 1
end
wait(0.5)
local allPlayers = game.Players:GetChildren()
for i = 1, #allPlayers do
allPlayers[i].Team = game.Teams.lobby
allPlayers[i].Character.PrimaryPart.CFrame = game.Workspace.SpawnLocation.CFrame
end
end)
end
while true do
start()
wait(20)
end
task.wait(3)
local function start()
task.spawn(function()
if game.Workspace:FindFirstChild("Map") then
game.Workspace.Map:Destroy()
end
local MapClone = game.ReplicatedStorage.Storage.Map:Clone()
MapClone.Parent = workspace
task.wait(2)
local allPlayers = game.Players:GetPlayers()
for i = 1, #allPlayers do
allPlayers[i].Team = game.Teams.game
allPlayers[i].Character.PrimaryPart.CFrame = MapClone.Spawns.Spawn.CFrame
end
game.Workspace.Time.Value.Value = 10
for i = 1,10 do
task.wait(1)
game.Workspace.Time.Value.Value -= 1
task.wait()
end
local allWinners = game.Teams.game:GetPlayers()
for i = 1, #allWinners do
print(allWinners[i].Name)
allWinners[i].leaderstats.Wins.Value += 1
end
task.wait(0.5)
for i = 1, #allPlayers do
allPlayers[i].Team = game.Teams.lobby
allPlayers[i].Character.PrimaryPart.CFrame = game.Workspace.SpawnLocation.CFrame
end
end)
end
while true do
start()
task.wait(20)
end