Bullet trail is not working properly

  1. What do you want to achieve?
    I have a bullet trail made with a Part and it works well as long as you’re not shooting while walking & jumping. The trail just gives a delayed result when shooting while walking or jumping. I was using Attachments and Beam before and solved the issue by making Attachment0 connected to the Barrel part of my weapon, don’t know how to fix this one.

  2. What is the issue?
    Current issueWhat I want to achieve

  3. What solutions have you tried so far?
    I’ve tried adding WeldConstraint however it ended up randomly changing my character’s position.

        local bulletTrail = Instance.new("Part")
		bulletTrail.Size = Vector3.new(0.15, 0.1, (hitPosition - origin).Magnitude)
		bulletTrail.CFrame = CFrame.new(origin, hitPosition) * CFrame.new(0, 0, -bulletTrail.Size.Z / 2)
		bulletTrail.Anchored = true
		bulletTrail.CanCollide = false
		bulletTrail.BrickColor = BrickColor.new("Bright yellow")
		bulletTrail.Material = Enum.Material.Neon
		bulletTrail.Parent = workspace.Terrain

		local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
		local goal = {Transparency = 1}
		local tween = TweenService:Create(bulletTrail, tweenInfo, goal)

		tween:Play()
		tween.Completed:Connect(function()
			bulletTrail:Destroy()
		end)

Is this server side or client side? Also, can you walk me through how this was working in the second video you sent?

That’s server side.

I managed to solve the issue when using Attachments by connecting to Barrel part of the weapon and the second video is the attachment version instead of a Part, however, I want to be using Part instead of Attachments

Okay, so the problem here is that, when you had the attachment to the barrel, the trail end connected to the barrel was forced to update its position to match the barrel’s. Now, none of that is done. The trail stays where it is. If you are insistent in making this work as a Part without attachments and server side, the only way I see this working is using something like RenderStepped or Heartbeat, to constantly adjust the trail’s size and position to match the latest position of the barrel.

Personally, I’d use the attachment and run this client side to reduce lag from the server. You’d need some sort of replication system so that other players saw the trail too