This script contains 2 functions, parts that run my game. I get an error Players.Player2.Backpack.LocalScript:20: bad argument #2 to 'random' (interval is empty) when it's time to choose the map. Any ideas why?
local player = game.Players.LocalPlayer
local messagegui = player.PlayerGui:WaitForChild("Messages")
local messageline = messagegui:WaitForChild("MessageLine")
repeat wait() until player and messageline and messagegui
function CheckPlayers()
if game.Players.NumPlayers >= 2 then
messageline.Text = "Game about to start."
else
messageline.Text = "Wait for 2 or more players."
end
end
function ChooseMap()
local maps = {}
local findmaps = game.ReplicatedStorage:WaitForChild("Maps")
for i,v in pairs(findmaps:GetChildren()) do
table.insert(maps, v)
end
local chosenmap = maps[math.random(1, #maps)]
chosenmap.Parent = workspace
end
while wait(1) do
repeat CheckPlayers()
until game.Players.NumPlayers >= 2
wait(3)
messageline.Text = "Choosing map."
ChooseMap()
wait(2)
end

2 comments
Umm, well the maps table is only receiving a single option.
You messed up on line 20. In line 16 you dont have any values inside of the Maps.f