Collection Service with Spatial Queries

Hello guys!

I have a question regarding CollectionService:

  1. What do you want to achieve? I want to ask if I can use Collection Service with Spatial Queries.

  2. What is the issue? I am not sure if this could work

  3. What solutions have you tried so far? I googled and looked through the devforum

I wanted to ask if you can use Collection Service with Spatial Queries like this<:

local collectionService = game:GetService("CollectionService")


for i, part in pairs(collectionService:GetTagged("Mine")) do

    local overlapParams = OverlapParams.new()
    overlapParams. FilterDescendantsInstances = {part}
    overlapParams.FilterType = Enum.RaycastFilterType.Exclude

    local parts = game.Workspace:GetPartsBoundInRadius(part.PrimaryPart.Position, 5, overlapParams)

    print(parts)
	
end

Can this work?

Thank you very much for your answers!

3 Likes

This would very much work fine, but I feel like you could just as easily use BasePart.Touched as it will likely be more performance friendly.

3 Likes

Thank you for your response.

But I need to check in a radius and not when the touched Event was fired.

Anyways, thank you!

1 Like

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