i have this script marked to fire the ray downward. additionally i have any hit parts marked with red. Yet the parts above it are being hit??
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
local ray = Ray.new(v.Position, Vector3.new(v.Position.X, v.Position.Y - 1, v.Position.Z))
local hit2, position = workspace:FindPartOnRayWithIgnoreList(ray, {game.Workspace.LeftArm, game.Workspace.RightArm, v})
print("RayFired")
if hit2 then
print(hit2.Name)
print(hit2.Parent.Name)
hit2.Transparency = 0.8
hit2.BrickColor = BrickColor.new("Really red")
--debug
end
if not hit2 then
for i, v2 in pairs(script.Parent:GetChildren()) do
if v2:IsA("BasePart") then
v2.Anchored = false
print("Hit")
end
end
else
for i, v2 in pairs(script.Parent:GetChildren()) do
if v2:IsA("BasePart") then
--v2.Anchored = true
end
end
end
end
end
result:
(Red mean hit by raycast and the misaligned bricks are the parts firing the raycast)