Oh, wait, here:
rayStart = --start point of ray
rayEnd = --end or intersection of ray
for i = 1, math.floor((rayEnd - rayStart).magnitude), 3 do
--Instance the new part here
Part.CFrame = CFrame.new((rayEnd - rayStart).unit * i)
end
And if you want the parts facing the ray's intersection point:
rayStart = --start point of ray
rayEnd = --end or intersection of ray
for i = 1, math.floor((rayEnd - rayStart).magnitude), 3 do
--Instance the new part here
Part.CFrame = CFrame.new((rayEnd - rayStart).unit * i) * CFrame.Angles(CFrame.new(rayStart, rayEnd):toEulerAnglesXYZ())
end |