Loading a Map from ReplicatedStorage or ServerStorage

Hi all,

I’m having a difficult time trying to load a map but trying to avoid lag. Some of the models do contain unions, so I understand this could be causing a problem. At the moment, I currently use a for loop to clone the parts from ReplicatedStorage or ServerStorage and parent them to their location in workspace. This is okay, but, it takes around 1 minute and 10 seconds to load a map whereas I would like something a little bit quicker.

Is there any other effective way to load a map other than a for loop or do I just have to do something else with the game while the players are waiting for the map to load?

Thanks,
Ryan.

5 Likes

Firstly, I recommend storing the maps inside ReplicatedStorage so the client has access to them and, therefore, can download them while playing. I also recommend storing the map inside a container, such as a Folder or Model. Then, when you want to use the map, you can just do replicatedStorageService.Map.Parent = workspaceService. If parts of the map are destroyed in-game (with explosions, for example) you’ll have to clone it instead to prevent wear and tear of the map overtime.

Something like this is never going to be instant, so a short pause dedicated to giving some time for the map to load is probably a good idea.

11 Likes

Couldn’t you just put the map under a model and just clone the whole thing over?

You don’t need a for loop to parent the Map model to Workspace. You can simply do:

local ServerStorage = game:GetService("ServerStorage")
local MapToClone = ServerStorage:WaitForChild("MAP_NAME"):Clone()

MapToClone.Parent = game.Workspace
7 Likes

If your maps are small then you can store them in ReplicatedStorage. This wouldn’t be ideal for larger maps as anything in ReplicatedStorage replicates to the client and thus will increase memory consumption.

2 Likes

Yeah, the main issue is the maps are fairly large so I would assume cloning the whole map model, which is how I store it, would cause a lag spike? For example, each house in the map is made up of around 150 parts each and there are 36 houses. There are some other building as well which are more detailed. I wouldn’t think there were more than 10,000-15,000 parts, but I do think the unions might be part of the problem.

For comparison, I would say they are maybe similar in size to Deathrun or Flood Escape 2.

1 Like

You may get a lag spike but its near to instantaneous, if you’re gonna do it in a loop then its not the best of your interest since you have to wait for longer.

You could try to speed up the process by doing a fixed amount models to be cloned to workspace (for example clone 10 basepart objects to workspace at one time.

I’d have to disagree there.

I use serverstorage to store the huge maps there and load them in to the workspace when necessary.

It makes the player load into the game much much faster. Big maps dont need to be replicated to the client if they’re not at all being used.

2 Likes

If they’re not being used at all, then I would question why they’re in the Explorer panel at all.

My general rule of the thumb is if it’s something small, I’ll store it in the ServerStorage; but if it’s something that will turn out to be a bigger concept, I’ll place it in the ReplicatedStorage.

I store my maps in server storage and when each needs to get picked then i load to workspace