OverlapParams

Constructors

NameDescription
new()Returns a blank OverlapParams object with default values for every property. Set its properties afterward to configure the query.

Code Snippet

local overlapParams = OverlapParams.new()
overlapParams.ExcludeInstances = {script.Parent}
overlapParams.MaxParts = 20

local size = Vector3.new(10, 10, 10)
local parts = workspace:GetPartBoundsInBox(CFrame.new(0, 5, 0), size, overlapParams)

for _, part in parts do
    print(part:GetFullName())
end

Properties

NameTypeDescription
ExcludeInstances{Instance}?An optional array of instances whose descendants will be excluded from the query. Can be used together with IncludeInstances for mixed filtering; if an instance matches both, the exclusion takes priority.
IncludeInstances{Instance}?An optional array of instances whose descendants will be included in the query. Setting this to nil includes everything, while setting it to an empty array ({}) includes nothing.
MaxPartsnumberThe maximum number of parts to be returned by the query. The default value of zero (0) means no limit.
CollisionGroupstringSpecifies a collision group for the operation. Parts in collision groups set to not collide with this group are ignored. Defaults to "Default" if not set.
TolerancenumberSlightly increases the volume of the boundary-querying operation, clamped between 0 and 0.05 studs.
RespectCanCollidebooleanWhen true, makes the boundary-querying operation use an intersected part's CanCollide value in favor of its CanQuery value when determining query results.
BruteForceAllSlowbooleanWhen true, ignores all part collision properties and performs a brute-force check on every part. Significantly hurts performance and should not be used in live experiences.
FilterDescendantsInstancesArrayAn array of objects whose descendants are used to filter query candidates, combined with FilterType. Superseded by ExcludeInstances/IncludeInstances but still supported.
FilterTypeEnum.RaycastFilterTypeDetermines whether FilterDescendantsInstances is treated as an exclude list or an include list. Superseded by ExcludeInstances/IncludeInstances but still supported.

Methods

NameParametersReturnsDescription
AddToFilter(instances: Instance | {Instance})Instances: Instance or array of InstanceVoidAdds one or more instances to FilterDescendantsInstances without needing to reassign the whole array. Superseded by ExcludeInstances/IncludeInstances.