Creating and destroying parts causes insane lag spikes and i have no idea why. I noticed this problem randomly yesterday and it never existed before that point so idk.
This video shows this issue, all im doing is creating a part and destroying it with game.Debris in a slow loop.
Things ive tried to combat this issue is turning off physics before destroying the part, setting its parent to nil instead and destroying it later but nothing seems to prevent it. This doesnt just happen in studio it also happens in the player, it happens with different users it also happenes when testing on my iphone 13.
This happens when destroying the part on the server and the client btw.
Here is the detailed graph for people smarter than me ^.
while true do
if script.Parent:FindFirstChild("partNow") then
local part = Instance.new("Part")
part.Anchored = true
part.Parent = workspace
part.CFrame = script.Parent.HumanoidRootPart.CFrame * CFrame.new(0,3,6)
game.Debris:AddItem(part, 3)
end
wait(1)
end
The loop i used in the video ^, yes the loop uses FFC but even a part that already exists being destroyed causes a lag spike.
Any help towards the right direction in fixing this is immense help thx for reading.
