local function randomMap()
local randMap = game.ServerStorage.Maps[math.random(1, #game.ServerStorage.Maps:GetChildren())]
return randMap
end
The line local randMap = game.ServerStorage.Maps[math.random(1, #game.ServerStorage.Maps:GetChildren())] raises an error saying 1 is not a valid member of Folder. I don't understand why this is happening.
Any help will be greatly appreciated :)

4 comments
math.random() supply's a pseudo-random number which is used to index** the map within the array; each table sorts the content at a ascending numerical placeholder, this is why we can use that function of the Math library in this scenario. To actively attain these maps within the array, we have to use the :GetChildren() method, this of which you forgot. Without it, you’re essentially calling Instan
Ok thanks!
also, #Maps:GetChildren() should be MapsFolder:GetChildren() correct?
Nope. When you use the hashtag operator, your basically getting "how much is in a table" when you put it next to a table value. That's why we pick maps based on how much maps there is.