It chooses a map to spawn out of ServerStorage but it wont work.
maps = {} local maps = game.ServerStorage for i, v in pairs(maps:GetChildren())do if v:IsA("Model")then table.insert(maps, v.Name) end end while true do randomMap = maps[math.random(1,#maps)] selectedMap = game.ServerStorage:WaitForChild(randomMap):Clone() selectedMap.Parent = game.Workspace wait(30) selectedMap:Destroy() end
:IsA() may not work with models, or maybe you used the wrong keyword. If this happens to me, I simply do the following:
maps = {} local maps = game.ServerStorage for i, v in pairs(maps:GetChildren())do if v.ClassName==("Model") then table.insert(maps, v.Name) end end while true do randomMap = maps[math.random(1,#maps)] selectedMap = game.ServerStorage:WaitForChild(randomMap):Clone() selectedMap.Parent = game.Workspace wait(30) selectedMap:Destroy() end
If that doesnt work, try putting a space between ("Model") and then.
Hope I helped.