Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FindPartsInRegion3 doesn't returns any object?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)

Ad

Answer this question