Not sure why, whenever this script runs, i get this error when it hits line 13?
if i == 1 then
timer.Value = "Randomizng A New Map!"
task.wait(2)
print("waited")
local rand = math.random(1, #maps) --> Line 13
local map = maps[rand]:Clone()
map.Parent = workspace
timer.Value = "Tester "..map.Name
task.wait(4)
local players = game.Players:GetChildren()
end
end
ServerScriptService.MainMainigame:13: attempt to get length of a Instance value
Putting your maps folder containing all your game maps in replicatedstorage specifically is not recommended because it takes up unnecessary client memory, so serverstorage should be used over it for containing things the server should be managing without client exploitation(Maps/ assets/ etc…)
This line right here, your still indexing a numbervalue on an instance, instead of the array of it’s children. You’d need to define the maps folder’s children and then use it for picking a random map
local mapPool = maps:GetChildren()
local rand = math.random(1, #mapPool)
local chosenMap = mapPool[rand]