My code:
local region = Region3.new(Vector3.new(500, 200, -498), Vector3.new(-500, 12, 498)) local mapArea = Instance.new("Part", workspace) mapArea.Anchored = true mapArea.CanCollide = false mapArea.Position = Vector3.new(0, 100, 0) mapArea.Size = region.Size
I'm trying to find any parts in between those two points, but when my code is run, the part it makes is tiny, and a straight line. Then, I run the :FindPartsInRegion3(region, ,mapArea, 1000). Please help! Is there an easier way to do this?
Region3's constructor requires a minimum and maximum vector. What it means by that is every coordinate in the minimum vector argument has to be less than the maximum. You could construct new vectors and take each coordinate of the original vectors and find the min/max of each
local function region3Vectors(vector1, vector2) local min = Vector3.new( math.min(vector1.X, vector2.X), math.min(vector1.Y, vector2.Y), math.min(vector1.Z, vector2.Z), ) local max = Vector3.new( math.max(vector1.X, vector2.X), math.max(vector1.Y, vector2.Y), math.max(vector1.Z, vector2.Z), ) return min, max end
Then just add that to your region3 constructor
local region = Region3.new(region3Vectors(Vector3.new(500, 200, -498), Vector3.new(-500, 12, 498)))