Region3 min and max

I created a region3 based off 2 part’s positions but when i create a part to represent the region 3 it looks wrong.


the red brick is the minimum and the green brick is the maximum and the grey brick is the region3. Anyone know why it didn’t work right?

here is my code
local part = script.Parent

local part1 = Instance.new(“Part”,workspace)

part1.Anchored = true

part1.Position = part.Position + (part.CFrame.RightVector*(part.Size.X/2) + part.CFrame.UpVector*(part.Size.Y/2) + part.CFrame.LookVector*(part.Size.Z/2))

part1.BrickColor = BrickColor.new(“Really red”)

local part2 = Instance.new(“Part”,workspace)

part2.Anchored = true

part2.Position = part.Position - (part.CFrame.RightVector*(part.Size.X/2) + part.CFrame.UpVector*(part.Size.Y/2) + part.CFrame.LookVector*(part.Size.Z/2))

part2.BrickColor = BrickColor.new(“Bright green”)

local region3 = Region3.new(part1.Position,part2.Position)

local bool = false

local par = Instance.new(“Part”,workspace)

par.Anchored = true

par.CFrame = region3.CFrame

par.Size = region3.Size

You should use ``` to put your code inside so it is easier to read.

--``` these will make the code text put them outside the code text like how I did

-- ```

Region3’s have to be both minimum and maximum in all three axes

Eg: 1,-1,-1 min
-1,1,1 max
would NOT work because the min X axis is not lower than the max X axis

Based on the angle of the sun in the image you took Id guess your X axis is messed up
You can easily fix this by just swapping the X values of min and max