Which is more effective in terms of performance: Debris:AddItem() OR Destroy()

My place has a lower framerate than other games, I’ve noticed. I’ve experienced a similar problem in the past, and it was caused by my scripts frequently calling:Destroy(), so I tried to work around it by grouping objects together and deleting them in “clusters” rather than individually. But what about the Debris:AddItem() method? Isn’t it similar in some ways? Is it the exact same?

Debris:AddItem() is the exact same but adds a delay to the :Destroy() and doesn’t yield the code. No performance changes as far as I’m aware.

2 Likes

If you’re experiencing a drop in frame rate, it’s most likely not being caused by destroy

1 Like

Thanks for the feedback, I wasn’t sure if it delayed to:Destroy() or not, but now I know. Once again, thank you! :slight_smile:

1 Like

Debris:AddItem() works like delay(…, function()) and then Destroy(), you can shorten your script in that way

I am not very experienced in framerate, so I don’t have any idea

1 Like

Thanks for the feedback! I can now relax knowing that it wasn’t either of these, and I won’t have to waste time trying to figure out what’s wrong with the script with both of them.

Thanks for the feedback! No worries, I appreciate your answer! :slight_smile:

1 Like