Custom rig Motor6d movement breaking when teleported

Hi, I’m trying to make a turret compatible with a placement system. This means that I would need to use model:SetPrimaryPartCFrame() to move the turret to the position. However, after teleporting, the turret does not aim properly anymore (It does before when it is not teleported)
Vid Demo: Screen Recording 2021-08-27 at 10.21.47 - Google Drive

Aim function code

local function aim(targetPart)
	local unit = (targetPart.CFrame.Position - script.Parent.Muzzle.CFrame.Position -,1),math.random(-1,1),math.random(-1,1))).Unit
	for i = 0.1,1,0.1 do
		joint.C0 = joint.C0:Lerp(,0,0),unit),i)


where targetPart is the enemy’s rootPart, and script.Parent.Muzzle is the Muzzle of the turret.
Anyone knows why the aim is broken after teleporting? Thanks for reading