How would I fix gun shooting delay

I’m currently having a problem with Guns, When I shoot and am standing still, everything is fine. However when I move, the bullet doesn’t exit out of the the barrel, but rather it exits out the barrel’s position a few frames ago.

I’ve tried to set the bullet’s position to the barrel right before it gets fired to no use, I’ve also tried adding velocity, which did fix it until you start jumping aswell.


How my guns work is: From the client, an input is detected. And at every .Stepped, It does :ViewportPointToRay() to get the world position of the target. This position is then sent off to the server and another ray is casted toward the target from the barrel to
check where the bullet will hit, From there, it creates the bullet:

function CreateBullet(LastHit,pos)
	if IsFiring then
		local HRP = Tool.Parent:WaitForChild("HumanoidRootPart")
		Fired = true
		--Create The Bullet
		local Part = Bullet:Clone()
		Part.Parent = workspace.Bullets
		local Dist = (BulletPoint.Position - pos).Magnitude
		Part.CFrame = + HRP.Velocity,pos)
		Burst1.Enabled = true
		Burst2.Enabled = true
		BurstLight.Enabled = true
		AnimateBullet(Part, BulletPoint.Position, pos)
		--Damage The Player
		if LastHit then 
			if LastHit.Parent:FindFirstChild("Humanoid") then
		Fired = false

If you need more code to understand, let me know. Thanks in advance.

1 Like

Found the answer to my question (Thanks to TwinPotatoes), Reduce Delay by handling the display of the bullet on the clients: