Best way to destroy parts

Currently, I have a train game. However, when it is destroyed (:destroyed() function). It lag spikes. I have tried to divide the train into 4 parts, and destroying them one after another. What would be the best way to destroy a mass amount of parts?

should not be lag spiking from just using :destroy(), even on a decent chunk of parts

you could try something like

local RS = game:GetService("RunService")
for i, v in pairs(TableOfParts) do
v:Destroy()
RS.Heartbeat:Wait()
end

or, if its a model and not just a table of parts, use :ClearAllChildren()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.