:Destroy() Causing lag spike

Screenshot 2025-11-06 183138

For some reason, every time I call the :Destroy() function for the first time, it causes two major lag spikes. But after that, it doesn’t lag at all—only the first time.

I have also tryed this in the Roblox Player app and it dose not lag, its only in studio.

:Destroy()

is a very powerfull command…

if you call :Destroy() on a model it will cause lag spikes as the game is destroying every model at the same time, but only in the first time… thats strange

Causes:

  • Having too much models in your game calling :Destroy()
  • A large model being called to Destroy

What you can do about it:

  • If wanting to destroy a large model, first make a CleanDestroy script to make the model firmly and rapidly destroys everything and not at the same time.

local function destroyModelSmoothly(model, delayTime)
	if not model or not model:IsA("Model") then
		warn("Invalid model")
		return
	end

	local parts = model:GetDescendants()
	local total = #parts
	local batchSize = 50 
	delayTime = delayTime or 0.01

	print("starting destruction of " .. total .. " objects...")

	for i = 1, total, batchSize do
		for j = i, math.min(i + batchSize - 1, total) do
			local obj = parts[j]
			if obj and obj.Parent then
				obj:Destroy()
			end
		end
		task.wait(delayTime)
	end

	print("Model destroyed smoothly!")
end

--put in your model to do it
local target = workspace:FindFirstChild("HugeModel") -- Replace with your model's name
destroyModelSmoothly(target)

if that doesnt work please explain what you are trying to destroy so i can help you better :smiley:

It is a single part that i am destroying

if the lag spike is causing alot of trouble you can just make the part invisible and go to a 999999,999999 position IF ITS SO IMPORTANTS

If that’s the case for this specific place, then maybe add a script which creates a part once and destroys it afterwards at the start of the server/client so future destroys don’t spike the client/server ¯\(ツ)/¯

If it’s a case in other places as well, maybe you can file a bug report.