Parts added to debris in Heartbeat are destroyed once next part is made

I’m not a regular (only a member) and it says only regulars can make new topics, but it lets me make a new topic there. Am I allowed to post a bug report or will it be flagged because I’m not a regular?

EDIT: I am going to wait a day or two before posting to Bug Reports, because I highly doubt this is a bug given the specific circumstances.

2 Likes

Ok, here’s a MAJOR update to the situation. All cases of Debris service are making parts get deleted in a single second. This was DEFINITELY not happening before. Something is seriously wrong with my game or with debris service.

1 Like

My final thought:
Could you try testing the game inside the regular roblox client (not in studio)?

I did and that is where I have discovered the whole game is broken now. This is really weird. Earlier not having it in a loop was fine. I will try to mess with some stuff until I find the heart of the issue.

1 Like

Definitely the issue is debris service. If I drop an ore I try to do that for 600 seconds and suddenly it’s also instant. Something is really wrong here. I may have to write my own module for this to prevent the game from dying.

MY FINAL UPDATE: I think one of my other scripts is adding too many items to debris service rapidly, causing it to overflow in some sort of way, despite the fact that maxitems is deprecated. This makes the most sense to me. I will attempt to find a better way to go about what I am doing there.

EDIT: I fixed the other script and it now works. This is a major facepalm for me. Turns out the DebrisService maximum still exists.

2 Likes
local debris = game:GetService("Debris") --outside of heartbeat loop

if ore then
	task.spawn(function()
		local clone = ore:Clone()
		clone.Anchored = false
		clone:SetAttribute("owner",script.Parent:GetAttribute("owner"))
		clone.Position = script.Parent.Spout.Position
		clone.Parent = workspace.droppedOres
		debris:AddItem(clone,120)
	end)
end
local debris = game:GetService("Debris") --outside of heartbeat loop

if ore then
	local clone = ore:Clone()
	clone.Anchored = false
	clone:SetAttribute("owner",script.Parent:GetAttribute("owner"))
	clone.Position = script.Parent.Spout.Position
	clone.Parent = workspace.droppedOres
	task.spawn(function()
		task.wait(120)
		clone:Destroy()
	end)
end

This will create new threads for each iteration/cycle of the heartbeat loop (each time the callback function connected to the Heartbeat event is executed). This may cause performance issues to arise however.

1 Like