Explosion versus Magnitude

Hello developers,

I’ve been wondering recently which is more efficient, looping through a table of players to get what players are close enough to an explosion to have damage dealt, or just using an explosion instance.

If anyone has answers, let me know. Thanks!

Is there a reason you are worrying about this performance difference?
For most cases the difference will probably be negligible.

You should test it out on studio, testing in studio is always key. But I would guess that looping through the players would be more performative for the simple fact that explosion instances are lag machines, especially on low-end devices and probably mobile. It used to be an easy way to lag some people out (for example in free admin games).

Unless Roblox has updated them, I advise against it if explosions in your project are frequent.

Edit: You should also try the workspace:GetPartsInPart() method and see how it compares to the other two alternatives.

Magnitude checks are way better. Using an explosion leads to unnecessary memory usage since you are creating an instance, not to mention you will be replicating the explosion which uses up bandwidth (if you instantiate the explosion in server).