So basically, the script gives the error "ServerScriptService.MainScript:29: attempt to get length of local 'tabOfPlayers' (a nil value)". This is on line 29, and I'm not sure why. I explained what 'tabOfPlayers' is in the function, so I have no other ideas. Help?
function handlePlrs(tabOfPlayers)
local plr1,plr2 = selectPlrs(tabOfPlayers)
plr1.Character:MoveTo(chosenmap.Spawn1.Position)
plr2.Character:MoveTo(chosenmap.Spawn2.Position)
end
function Match()
if not gamedebounce then
gamedebounce = true
local function Intermission()
for i = intermissiontime, 0, -1 do
if #playingplayers > requiredplayers then
gui.Text = "Intermission: "..i
else
gamedebounce = false
return
end
end
wait(1)
end
Intermission()
wait(15)
selectPlrs()
wait(5)
handlePlrs()
gameInPlay = true;
end
end
while wait() do
if #playingplayers >= requiredplayers and not gameInPlay then
Match()
end
end
Variables:
local gamedebounce = false
local playingplayers = {}
local gametime = 30
local intermissiontime = 15
local requiredplayers = 2
local gui = game.Workspace.ControlBoard.Holder.Mode
local gameInPlay = false;

1 comment
To add on, you also haven't defined anything in your call to the selectPlrs function a few lines above the call to the handlePlrs function.