Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Region3 Script Working In One Model But Not The Other?

Asked by
Donut792 110
13 days ago
Edited 13 days ago

alright so i got this region3 script here and it works fine in one of my models that i used for testing so i duped it and moved the corners and now the script only prints 0 found in region no matter what but in my other model it works absolutely fine excuse the indentation the myself and stackedit messed it up

local topCorner = script.Parent.TopCorner.Position

local bottomCorner = script.Parent.BottomCorner.Position



local function DrawRegion3(bottom, top)

local part = Instance.new("Part", script.Parent)

part.Name = "Region3Part"

part.Anchored = true

part.CanCollide = false

part.Transparency = 0.8

part.CFrame = CFrame.new((bottom+top)/2)

local size = top-bottom

part.Size = Vector3.new(math.abs(size.X), math.abs(size.Y), math.abs(size.Z))

return part

end DrawRegion3(bottomCorner, topCorner)



local region3 = Region3.new(bottomCorner, topCorner)



for _ = 1, 20 do

wait(4)

local partsFound = workspace:FindPartsInRegion3(region3, script.Parent)

print(#partsFound, "in region:")

for i = 1, #partsFound do

if partsFound[i].Name == not "HumanoidRootPart" then

else

if partsFound[i].Parent.Parent.ClassName == "Accessory" then

print(" " .. tostring(i) .. ". " .. partsFound[i].Parent.Parent.Name)

else

if partsFound[i].Parent.ClassName == "Model" then

print(" " .. tostring(i) .. ". " .. partsFound[i].Parent.Name)

end

end

end

end

end

Answer this question