Collapse Sidebar


GetPartsInPart returns an array of parts whose occupied space is shared with the given part, which must exist in the same WorldRoot (Workspace) as the parts to be queried.

Queried parts that are merely touching the given part are considered occupying the same space. This function can be used in place of BasePart/GetTouchingParts, and is generally a better choice in most cases.

Beware that this spatial query function considers the exact volume occupied by the given part using a full geometric collision check. A concave/hollow part won’t match queried parts within it unless they actually overlap/touch such a part. For simpler volumes, consider using WorldRoot/GetPartBoundsInBox|GetPartBoundsInBox or WorldRoot/GetPartBoundsInRadius|GetPartBoundsInRadius instead, as they are faster at the cost of being less accurate.

This function uses an datatype/OverlapParams object to describe reusable portions of the spatial query, such as an instance whitelist/blacklist, the maximum number of parts to query, and what articles/Collision Filtering|collision group to use. When making repeated spatial queries using functions like this, you should construct just one of these objects and reuse it.

This and other spatial query functions do not consider parts’ BasePart/CanCollide|CanCollide or BasePart/CanTouch|CanTouch properties. However, it will consider parts’ collision group if specified by the given OverlapParams.


Name Type Default Description

The part whose volume is to be checked against other parts

OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}

Contains reusable portions of the spatial query parameters


Return Type Summary

An array of BasePart which matched the spatial query