This script should globally call maps however I recieve an error when running it.
function _G.GetMaps() -- can now be used in any other server script
local maps = game.ServerStorage.Maps:GetChildren()
for _,v in pairs(maps)do
local randommap = math.random(v)
x=randommap:Clone()
x.Parent = game.Workspace
local m = Instance.new("Message", workspace)
m.Text = (x.Name.. " is the current map!" )
wait(3)
end
end
any and all help appreciated
Error I recieve when running the script
23:35:48.089 - ServerScriptService.GetMaps global function:5: bad argument #1 to 'random' (number expected, got Object)

2 comments
the script works, but I can not remove the Message.
Uncomment line 11