Problem with region3

Hello devs!,

im having a problem with region3 i want to detect if a part is inside the region and i wrote this simple function for it.

function isInsideRegion(part, region) 
	return workspace:FindPartsInRegion3WithWhiteList(region, {part})
end

my script uses a grid of 8 when placing normal models and a grid of 4 when placing walls.

until yesterday all was fine. i didnt change anything and now all of a sudden the region3 doesnt detect walls anymore.

(antiRotationPrimaryPart = a clone of the primarypart thats not anymated to make sure the lookvector isnt effected by the parts x,z rotations)

this is the grid for the walls

local vector = Vector3.new(math.floor(x / grid) * grid, (math.floor(y / gridY) * gridY) + defaultRaise, math.floor(z / grid) * grid)
local lookvector = antiRotationPrimaryPart.CFrame.lookVector * grid/2
mouseLocation = (CFrame.new(vector) - (lookvector)) * CFrame.Angles(0, math.rad(rotation), 0)

this is the grid for all other models

mouseLocation = CFrame.new(math.floor(x / grid) * grid, (math.floor(y / gridY) * gridY) + defaultRaise, math.floor(z / grid) * grid) * CFrame.Angles(0, math.rad(rotation), 0)

can somebody tell me what could be the problem?

its kinda a big deal players cant place walls anymore now :frowning:

So i fixed the problem by making my own region3 check here it is:

function isPartInRegion(part, region)
	local pos = part.position
	local regionMin = region.CFrame.Position - (region.Size/2)
	local regionMax = region.CFrame.Position + (region.Size/2)
	
	local x = pos.X > regionMin.X and pos.X < regionMax.X
	local y = pos.Y > regionMin.Y and pos.Y < regionMax.Y
	local z = pos.Z > regionMin.Z and pos.Z < regionMax.Z

	return x and y and z
end