Hi. I'm making a gun script, and using raycasting. So, for the ray, one part in the parameters is the facing, and for this, I use a part's CFrame.lookVector, as it's not associated with the player quite yet (so I can't use mouse.Hit.p). Everything's working okay, except for the fact that the ray is casting to the left, instead of to the front. I've made sure "FirePart" is facing the front, and the part's "Front" is correct, but the ray is still being cast to the left. Can somebody help me with getting the ray to be casted forward? Thanks.
Relevant Code:
local ray = Ray.new(script.Parent.FirePart.CFrame.p, (script.Parent.FirePart.CFrame.lookVector - script.Parent.FirePart.CFrame.p).unit*300)
local hit, position = game.Workspace:FindPartOnRay(ray, nil, false, false)
rayPart.Size = Vector3.new(projectileThicknessX, projectileThicknessY, distance)
rayPart.CFrame = CFrame.new(position, script.Parent.FirePart.CFrame.p) * CFrame.new(0, 0, -distance/2)
(rayPart, all other previous variables defined before)

2 comments
Thank you so much, it works now.
No problem