Pretty self-explanatory, didn’t know this until I read the Debris service API about the removal of an instance is just :Destroy()
. Is Debris service better or not? Or is there another alternative?
Debris will be useful only if the instances are at risk of being destroyed by other means, such as being sent into the void or having race conditions with Instance:Destroy()
.
Debris is only useful for stuff that aren’t needed and can be destroyed at any moment. Please note that there is a limit on how many parts may exist at once and if over that limit parts will be destroyed even if their timer hasn’t reached yet.
I really don’t quite understand that well.
So when I for example wants to shoot a bullet and delete it a few seconds later, does this mean I can call the function every time the bullet is fired?
Let’s put this in an example:
You have one unanchored part in workspace. This thing can fall out to the void. If it does fall into the void, calling Instance:Destroy()
will error. Therefore, you should use Debris to avoid bumping into an error.