Rotated Region3 Module issue

Hey everyone!
Currently I found very useful module Rotated Region 3 Module (Rotated Region 3 Module)
I read comments to find answer for question: Is it laggy or not?
I didn’t found really good answer for this question, so now I ask you.
As an example, take this code (Server and client side):

local Region3Module = require(123456789) -- Rotated Region 3 module
local region =,Size)
while wait() do
      local parts = region:FindPartsInRegion3(nil,5)
      if #parts > 0 then

That’s really important for my game because optimization is not that good already, that’s why I need to know do I need to use it or not.

Is there any reason it needs to be wait() instead of larger time?

Could you make it event based by doing the region check only after a touch event was received?

Nobody can tell you if it’s “laggy” or not without the context of the entire game and how many of these checks you’ve got going on.

As a general rule of thumb don’t do processing unless you need to. Use events as triggers instead of infinite loops, and where loops with expensive operations are required, do them as infrequently as possible.

If you could get away with up to 1 second delay in response, then make it wait(1) for example, if you really want to stick with a loop.

Actually, .Touched isn’t that good. If object already inside of the part, it won’t say that it is touched.
Aswell, I can’t use :GetTouchingParts() because I have objects without collision.
About laggy, you are right. I will try to ask my community about it.
I won’t use wait() because I need to use it in several places. I will use wait(1).
If you wonder, I am making a parking system, so you can’t spawn your car if this place someone took already.

Why does it need to be in a loop then? Can’t you just do 1 check when the person tries to spawn?

Depending on the exact behaviour expected you could always do some raycasting instead, either vertically or horizontally through the spawn area, with a whitelist to just return pieces of cars. I imagine that would be quicker than Region3 in a lot of cases.

Wow, thanks!
That’s a really good tip.