Client-Side Map Loading/Unloading System

Hi, for my current project I’ve been working on a system for loading + unloading sections of the map according to where the player is currently exploring. So if they enter a gateway from area A to area B, then A will unload and B will load.

Currently this works by storing these areas in ServerStorage and sending them directly to the client when required. This is to prevent too high memory usage on the client. The main issue I’ve found with this method is that when unloading the old areas the client’s memory usage doesn’t necessarily go down straight away which can lead to the client’s memory going over 1000MB. I believe this is down to Roblox’s garbage collection happening at random intervals.

I’m worried that this is harming the performance in my game. Will high memory affect performance even if it’s waiting to be garbage collected? Are there any tricks for decreasing memory faster after unloading areas? Please let me know if you have any ideas!

Instead you can try to use Roblox’s content streaming

Thanks. I’m looking into this today. Is this the only way to deal with something like this without encountering the problems I mentioned above?

A way you could do this is unloading the map 1 by 1:

local Value = 1

for i = 1,50 do -- How many parts you have in your Map (50 for example)
    Map:GetChildren()[1].Parent = game.ServerStorage.Collect -- Placing the first part the script finds into ServerStorage
end

This way the memory would take notice parts are leaving the players client therefore the client lowers the amount of memory needed.

However, you’ll still probably have to wait for the garbage collection system.

The ServerStorage isn’t visible on the client so this wouldn’t work, but thanks anyway!

Sorry for the late reply. I thought you handled this on the server, you could store it in ReplicatedStorage instead.