Region3 not working

I’m new to Region 3 and I’m sure that I’m just making a simple mistake, but my Region3:FindPartsInRegion3 is not returning a valid table.
Here is my script:


The script keeps printing 0 (because of the print(#ParsInRegion)).
This is my baseplate:
image
The 2 points are not nil.

2 Likes

I figured out why your region3 isn’t working.
To make a Region3 works you need two positions, position1 and position2, where position2 must be greater than position1. The problem is probably that position1 is minor than position2, so check both parts position and modify all the three position axis to make the first position be minor than the second one.

To check if your Region3 is getting spawned correctly simply do this:

local region = Region3.new(pos1, pos2) -- That's the Region3
local  part = Instance.new("Part") 
part.Size = region.Size 

by this way a part gets generated with the exact sime size as the Region3

Here’s a video I found helpful: https://www.youtube.com/watch?v=XAwoodFJWos

I hope it helped!

1 Like

Order of the bounds in the Region3 constructor matters as described in: Region3 | Documentation - Roblox Creator Hub

That’s why you will have to change your Region definition to this:

local Region = Region3.new(
    Vector3.new(
        math.min(Point1.X, Point2.X),
        math.min(Point1.Y, Point2.Y),
        math.min(Point1.Z, Point2.Z)
    ),
    Vector3.new(
        math.max(Point1.X, Point2.X),
        math.max(Point1.Y, Point2.Y),
        math.max(Point1.Z, Point2.Z)
    )
)
5 Likes

Thank you so much! I’ve searched for hours, literally. I’ve tried so much things, you saved my project!

2 Likes