Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

FindPartsInRegion3 doesn't returns any object?

Here is my code. I have dummy objects for checking region3 points and it's correct. It's not printing anything :/

local first = Vector3.new(script.Parent.Position.X-script.Parent.Size.X/2,-5,script.Parent.Position.Z+script.Parent.Size.Z/2)
local second = Vector3.new(script.Parent.Position.X+script.Parent.Size.X/2,script.Parent.Size.Y,script.Parent.Position.Z-script.Parent.Size.Z/2)

local part1 = Instance.new("Part", workspace)
part1.BrickColor = BrickColor.Red()
part1.Anchored = true
part1.CanCollide = false
part1.Position = first

local part2 = Instance.new("Part", workspace)
part2.BrickColor = BrickColor.Green()
part2.Anchored = true
part2.CanCollide = false
part2.Position = second

while true do
	wait(5)
	local parts = workspace:FindPartsInRegion3(Region3.new(first,second))
	for _,part in pairs(parts) do
		print(part.Name)
	end
end

1 answer

I didn't know that but it's worked when first vector3 was lower than second vector3. (X,Y,Z Should be lower than the second X,Y,Z)

This discussion is preserved as it was. New answers, comments, and votes are closed.