How to Properly Get the Parts Touching an Object

I am making a script that relies on knowing which parts are touching a certain part. I have made an image that helps further explain what I’m trying to achieve:

I tried using :GetTouchingParts(), but that only works with scenarios like the “Not this” part of the picture.

You can do this by constantly checking the magnitude of the two parts to see if they are touching. But it could be done another way considering what the actual situation is. are either of these parts cancollide off?

I’m making a fire spreading script and I need to find all the parts touching a part on fire, then making those touching parts on fire. Also, all the parts have CanCollide set to true.

If a part is in the “not this” then wouldn’t it be on fire?

This isn’t an issue as none of the parts are intersecting.

If get touching parts isnt working then the only way I can think of doing this without usint extremely complicated math is to make a region3 box that is .01 studs bigger in all directions then the part on fire and then getting all the parts in the region3.

Wouldn’t that be very inefficient and cause a lot of lag?

I just benchmarked it and creating a region 3 and searching for parts in it take about 26 one hundred thousandths of a second (0.00025699997786433) seconds

I don’t even know how to use Region3.

local region = Region3.new(min vector3, max vector3)
local partInRegion = workspace:FindPartsInRegion3(region)

I still don’t know what to do with this information.

The region variable is the box in the 3D space being created. the min Vector3 value is one corner of the part, and the max Vector3 value is the opposite corner of the part. After the position of the corners of the parts are found add Vector3.new(-.05, -.05, -.05) to the lower corner(minValue) and add Vector3.new(.05, .05, .05) to the top corner(maxValue). after you find the region the partsInRegion variable will return a table with the parts in the region. This is a good video to learn from: Advanced Roblox Scripting Tutorial #17 - Region3 (Beginner to Pro 2019) - YouTube

You could try this.

local params = OverlapParams.new()
params.FilterDescendantsInstances = {--[[If you want to detect the green one, you should put blue one in here, you'll get the idea]]}
params.FilterType = Enum.RaycastFilterType.Blacklist
	
local touchingParts = workspace:GetPartBoundsInBox(Part.CFrame, Vector3.new(Part.Size.X + .25, Part.Size.Y + .25, Part.Size.Z + .25), params)