I have a layout like so:
Model -Script -Shelves --Shelf1,Shelf2, etc..
The script is:
function countCrates()
for i,v in pairs(script.Parent.Shelves:GetChildren()) do
local ray = Ray.new(
Vector3.new(v.Position),
Vector3.new(0,5,0)
)
local part = workspace:FindPartOnRay(ray)
print(v.Name.."Has part on it")
print(part)
end
wait(1)
end
countCrates()
This returns random parts, rather than the crate on each shelf. Why will it not work?

1 comment
That wasn't my problem, I meant why does it say there is no part? Even when there is a part directly on it?