Help with Region3

I’m using Region3 for the first time, I’m not sure if it’s acting correctly or if I’m using it wrong.
What I’m trying to do is find if there are any parts in a certain area. I have 2 parts in each corner of the Region to get the area.

--Region1
local Region1 = script.Parent.Region1

local X1 = Region1.Position.X
local Y1 = Region1.Position.Y
local Z1 = Region1.Position.Z

--Region2
local Region2 = script.Parent.Region1

local X2 = Region2.Position.X
local Y2 = Region2.Position.Y
local Z2 = Region2.Position.Z

while wait(5) do
	local Region = Region3.new(Vector3.new(X1,Y1,Z1),Vector3.new(X2,Y2,Z2))
	local isEmpty = workspace:IsRegion3Empty(Region)

	print(isEmpty)
end

When I change it (workspace:IsRegion3Empty(Variaties)). It either prints false constant or true, but when parts enter or leave the area. It continues to print the same thing.

Not understanding you too much. Sorry for this question but, what is the issue?

Im trying to see if any parts are in the area, even when the condition changes, it always prints true or always prints false.

You seem to be creating many Regions3, because you have putten it into a while loop.

I’am waiting for your response.

I changed it to this but nothing happended. It checking the same area each time so positions wont change.


local Region = Region3.new(Vector3.new(X1,Y1,Z1),Vector3.new(X2,Y2,Z2))

while wait(5) do
	local isEmpty = workspace:IsRegion3Empty(Region)

	print(isEmpty)
end

Did you get any errors? [30 char]

No it just keeps print false, when a model (Vehicle) enters it.

If it helps i have also tried

workspace:IsRegion3EmptyWithIgnoreList

but that never helped. Or changed the outcome

Region3 is constructed of a position value, and a size value, not a position value and another position value. Is this your problem?

I would assume so, how would I change it then to size, would the first part be the center point of that? shape then? or is it a corner piece?

I think it creates a Region3 around the corner. You can make it the middle by using the code here:

Here’s also the link to the Developer Hub page:
Region3 | Documentation - Roblox Creator Hub