Bow arrows not positioning correctly on moving target

I’ve been making an arrow projectile system when i came across this strange problem.

image
This here works as intended because the target is stationary.
But if the target was moving at the time when the arrow hits then this happens:
image
Code sample:

local Touch = Ray_Result.Instance
local Point = Ray_Result.Position
	
local Enemy = Touch.Parent
local Despawn_Time = 30
	
local Look_Vector = Arrow.Collision_Box.CFrame.LookVector
local Offset = Look_Vector * Arrow.Collision_Box.Size.Z/3
local Arrow_CFrame
	
Arrow.Collision_Box.Massless = true
Arrow.Handle.Trail.Enabled = false
	
if not Touch.Anchored then
	Arrow_CFrame = CFrame.new(Touch.Position - Offset,Touch.Position + Offset)
else
	Arrow_CFrame = CFrame.new(Point - Offset,Point + Offset)
end
	
Arrow:SetPrimaryPartCFrame(Arrow_CFrame)

if not Touch.Anchored then
	local Weld = Instance.new("WeldConstraint")
	Weld.Name = "Hit_Weld"
	Weld.Part0 = Arrow.Handle
	Weld.Part1 = Touch
	Weld.Parent = Arrow.Handle
	Arrow.Handle.Anchored = false
end

Arrow.Parent = workspace

I really don’t know any ways to fix this so any help is appreciated.

I think this is caused by ping issues - there’s a delay between character movement and the .Touched event firing. I’m not really sure how would you fix it though.

I think you should say this in your script, for no delay issues:

PrimaryPart:SetNetworkOwner(nil)

There is the API for NetworkOwnership

1 Like

This won’t help since player character’s network owner is always the player while arrow’s network owner is either server or another player.