Bullets Ejecting in the wrong direction

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Bullet ejection system.

  1. What is the issue? Include screenshots / videos if possible!

Bullets go in the same X direction, making them fall from example: front, not the side.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Tried getting bullet CFrame X, didn’t work.

This is the script I use (local script):


	local BulletClone = Tool.Bullet:Clone()
	BulletClone.Parent = workspace
	BulletClone.Orientation = Tool.Bullet.Orientation
	BulletClone.CanCollide = true
	BulletClone.Transparency = 0
	BulletClone.Anchored = false

	local NewBody = Instance.new("BodyVelocity")
	NewBody.Parent = BulletClone
	NewBody.MaxForce = Vector3.new(1000000, 1000000, 10000000)
	NewBody.P = 500
	NewBody.Velocity = Vector3.new(20,0,0)

            wait(0.1)

	NewBody:Destroy()
	game:GetService("Debris"):AddItem(BulletClone, 5)

Hope I explained the issue well, if not here is the video of the issue:

1 Like

You’ve set velocity to (20,0,0) which is the same direction for every bullet, so you’re not taking into account which way the bullet is facing. Try using the LookVector of the bullet CFrame and multiply it by the speed you want.

1 Like

Hmm, how can I get the LookVector?

1 Like
Bullet.CFrame.lookVector -- Vector bullet is looking

Tried NewBody.Velocity = Vector3.new(Tool.Bullet.CFrame.lookVector.X * 20, 0, 0), didn’t work.

Try
NewBody.Velocity = Tool.Bullet.CFrame.lookVector * 20

you want all of the components of the look vector

1 Like

Works! Thank you so much! Man, I have been trying to fix this for weeks, knew DevForum will help!