Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to rotate LookVector value?

I'm trying to make a pistol, but I'm stuck at this part. The char.CharPistol.Shoot is the pistol's barrel inside the character.

bullet.Velocity = (char.CharPistol.Shoot.CFrame.LookVector * Vector3.new(1, 1, 1)) * 10

The bullet flies left

bullet.Velocity = (char.CharPistol.Shoot.CFrame.LookVector * Vector3.new(-1, 1, -1)) * 10

The bullet flies right. If the two values on the side are not equal, the bullet flies weirdly, but not forward. How can I make the bullet fly straight forward?

1 answer

✓ Accepted answer

try using vector3.Unit

local gun =  workspace.Part
local aim =  workspace.Part2

bullet.Velocity = (gun.Position-aim.Position).Unit * Speed

Place the aim part in front of the gun part and weld them

(sorry for my bad english)

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.