I'm getting this error:
ServerScriptService.MainScript:22: function arguments expected near 'for'
in the output. Here's my code:
local replicatedstorage = Game:GetService('ReplicatedStorage')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapstorage = game.Workspace:WaitForChild('MapStorage')
while true do
while game.Players.NumPlayers < 2 do
status.Value = "There aren't enough players"
repeat wait(2) until game.Players.NumPlayers >= 2
end
for i = 15,0,-1 do
status.Value = "Time until next round: " ..i
wait(1)
end
local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren()
local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
status.Value = "Get ready to start!"
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren
for _, player in pairs (game.Players:GetPlayers()) do
if player and #spawns > 0 then
local torso = player.Character:WaitForChild('Torso')
local allspawns = math.random(1, #spawns)
local randomspawn = [allspawns]
if randomspawn and torso then
table.remove (spawns, allspawns)
torso.CFrame = CFrame.new(randomspawn.position + Vector3.new(0,2,0))
local sword = game.ReplicatedStorage.Sword
local newsword = sword:Clone()
newsword.Parent = player.Backpack
end
end
end
wait(30)
wait(15)
mapstorage:ClearAllChildren
end |