Bullets flying in a weird angle

Hi, im making a shooting system. Basically when player presses a button, he fires a bullet in front of him. I used LookVector of HumanoidRootPart of the player

local bulletvector = hrp.CFrame.LookVector
	local direction = Vector3.new(bulletvector.X, 0, bulletvector.Z)

and then LinearVelocity to shoot the bullet

atta.Parent = bullet
	local LV = Instance.new("LinearVelocity")
	LV.Attachment0 = atta
	LV.MaxForce = math.huge
	LV.VectorVelocity = direction * 100
	LV.Parent = bullet

When i stand still, all is good, but problem is when i move backwards. The bullets start going crazy and flying in a “cone”:

My top down camera script works like that:

game:GetService("RunService").RenderStepped:Connect(function()
	MousePos = mouse.Hit.Position
	hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(MousePos.X, hrp.Position.Y, MousePos.Z))
end)

What could be the issue?

1 Like

Alright so what the issue is, on the server the HumanoidRootPart keeps moving back on forth, while on your screen it does not.

So when you move backwards the server sees you trying to rotate and then returning to your original position.

To fix this issue set the property of the humanoid AutoRotate to false.

2 Likes

Thanks, i had literally no clue what was happening <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.