Based on my previous mistakes and some posts that I’ve read - I would like to advice to load bigger maps piece by piece, otherwise it’ll lag the server for a moment. Referring to How should I handle loading maps? - #4 by Cartoon_Corpze
Like so:
local ServerStorage = game:GetService("ServerStorage")
local MapsFolder = ServerStorage.Maps
---//Choose map function
local ChosenMap = MapsFolder[math.random(#MapsFolder)]
function loadMap()
--//Send the clients a message that the map is loading (Perhaps a notification UI?)
for Index, Part in pairs(Chosenmap:GetChildren()) do
v:Clone().Parent = workspace.CurrentMap --//Assuming you have a CurrentMap folder in the workspace
task.wait(.1)
end
--//Send the clients a message that the map is ready
end
Also I’d use the event :ClearAllChildren() for the map removal