What method would you use to make a large, moving hitbox?

So far i’ve use RaycastHitBox and Region3 but none of them would be effective for what i’m trying to achieve rn.

Would using a large basepart with an align position or a linear velocity work? Then all you need to do is add a Touched event through a script.

1 Like

Yeah i know the default answer is Touched event, but it sucks, i was looking for other methods

Try the spatial query stuff, like workspace:GetPartsInPart


How is that used in a moving part?

Call the spatial query on an interval. The lower the interval, the more frequent you check for collision.

local interval = 0.5 -- Time between checks (in seconds)

-- Loop that constantly checks for collision on a part
while true do
     local results = workspace:GetPartsInPart(PART) -- Returns a table with parts it hit.
1 Like

would making loops for the hitboxes affect the performance negatively? The loops would have to be tight if i want a accurate hitbox, and there would be multiple of these hitboxes in the game at the same time too

You can run the queries several times per frame without much of an effect (or any at all) from my experience.

If your hitboxes are box-shaped, you can use GetPartBoundsInBox instead of GetPartsInPart for more performance but less accuracy (it checks bounding boxes instead of the actual geometry).


Do it on a runservice event like heartbeat, since it likely won’t move more than once a frame. Also yea, performance should be fine unless you do an insane amount in the thousands or something in a frame.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.