Should I keep all maps in workspace or load/remove them into workspace each time I need them?

If I have a game which switches maps each round, would keeping all maps loaded in workspace cause lag for the players?

Would it be better to remove the current map and load the new one, and if so, how could I achieve that?

Yeah so what I would have, if this some sort of minigame type game, I would have a function called Clear() or CleanUp() where it would reset everything. In this case the map so I would have something like this:

function CleanUp()
   workspace.CurrentMap:Destroy() -- Assuming its a model called "CurrentMap"

Additionally, I would also have some sort of randomiser which gets a random map from ReplicatedStorage like so:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
function RandomMap()
   local Map = ReplicatedStorage.MapsFolder[math.random(#ReplicatedStorage.MapsFolder)]:Clone()
   Map.Name = "CurrentMap"
   Map.Parent = workspace
1 Like

More than likely yes, especially if you have a ton of random maps cluttered nearby inside your workspace

Players who have PC’s the working capacity of a toaster probably wouldn’t be able to play the game if you went & did that

Here’s what you could do for creating a basic map system maybe, you’d need to put all your maps inside a Folder of some sort so you’re able to get their children:

local LastMap
local MapDurationTime = 300

while true do
    local Maps = game.ServerStorage.Maps:GetChildren()
    print("Current Maps")

    local RandomMap = Maps[math.random(1, #Maps)]
    if RandomMap and RandomMap ~= LastMap then
        LastMap = RandomMap

        local MapClone = RandomMap:Clone()
        MapClone.Parent = workspace



This loop will pretty much select a random map, and after a certain interval of seconds it’ll automatically delete the current & select a new map


Thanks to you and @TheDCraft ! I guess I’ll use a map loading/deleting system then.
But how would I go about deleting/loading Roblox terrain which is different with each map?

That’s a much more complicated structure, but I’m gonna take a guess as to what you could maybe do

  • Create variables for the specific Terrain you want to construct out of

  • Set the Terrain generation on an area where there’s no other Terrain

  • Delete the Terrain using FillRegion & setting the Material to Enum.Material.Air

There is also an API Reference for this: