Maybe I’m missing something obvious, but for context I’m using :GetPartBoundsInRadius() for enemy detection, as I have so many enemies that it’s more efficient to use SpatialQueries instead of iterating and calculating distance for each enemy. To try to make this more efficient, I set the collision group for each enemy’s root part to “Pet” and I set the target collision group to “Pet” as well, but it’s somehow printing printing parts not in the “Pet” collision group.
local RANGE = 50
function Pet:_CheckForEnemies()
local Origin = self.PetRoot.Position
local Enemies = game.Workspace:GetPartBoundsInRadius(Origin, RANGE, self._EnemyParams)
warn(Enemies)
end
-- In another block of code:
self._EnemyParams = OverlapParams.new()
self._EnemyParams.CollisionGroup = "Pet"
self._EnemyParams.FilterType = Enum.RaycastFilterType.Exclude
self._EnemyParams.FilterDescendantsInstances = {self.FormationFolder}
