I have made a gun like script to fire a projectile and I came across this logic error. The part is facing the direction it is traveling just at the wrong orientation, the wrong side is facing the direction of travel. This picture shows the syringe's point facing the ground with the side of the syringe facing the point. I want the point of the projectile facing the direction of travel. This is the positioning code I used.
local spawnPosition = (Right.Doctor.Syringe.CFrame * CFrame.new(2, 0, 0)).p
bullet.CFrame = CFrame.new(spawnPosition, mouse.hit.p) -- This is the positioning line I have set it to
bullet.Velocity = bullet.CFrame.lookVector * 60 -- 60 is speed
bullet.Parent = game.Workspace
On line 2 I have set it to face the position the mouse was at when the mouse clicked. I have tried changing the orientation with radians, but that hasn't works so far, yet I am fairly new with radians, so I may be using them inaccurately. This was my raidan attempt:
bullet.CFrame = CFrame.new(spawnPosition, mouse.hit.p*(1/2*math.pi))
However there was no change in rotation of the syringe(bullet)

3 comments
Got this error: attempt to multiply a Vector3 with an incompatible value type or nil
Why are you multiplying by
CFrame.Angles()? That does nothing.You actually put numbers the rotation you need ...