Ping issues in my game

I have been working on this game for a while and today I noticed that my ping goes like around 3k+ when the map spawns, I am cloning the map from ServerStorage to WorkSpace. This is the code I am using to spawn map.

game.Workspace.Map:ClearAllChildren()
for i, v in pairs(game:GetService("ServerStorage"):WaitForChild("Map"):GetChildren()) do
	v:Clone().Parent = game.Workspace.Map
end

The ping remains normal while the map loads in. But after a few seconds (after the complete map loads in), the ping raises from 150 to 3k+. This happens every time.
Anyone know why is this happening and how to fix this ?

I recommend adding a task.wait() to the code, so it doesn’t lag.

This is a pretty bad method, as you could just make the map a model, and parent it instead of this.

if I add a task.wait(), as there are a lot of child in the map, it’s gonna take a very long time… and coming to 2nd point, that would create a huge lag and wouldn’t load the complete map for the clint, that’s the reason I switched to parenting child to workspace.

Alright but like, cloning it individual every time is pretty inefficient and will cause lag, just clone the model, and parent it instead of every single thing.

Second that, make a it a model and then clone the model, looping through all the parts is quite inefficient

like you and @Busterguy said, that was my first choice to spawn the map. But I ran into an issue with that method, here is a dev forum post I’ve made to resolve that issue. So parenting the model wouldn’t be the best in this case.