Terrible Turret Accuracy

https://i.gyazo.com/39ff1c449888b21fbd8f415c85a2ce1b.mp4
for some reason, the turret does not shoot exactly on my character (the tag is in my humanoidrootpart)

i understand you may not want to read it all so i’ve done a bit of testing and commented on a line that seems to be affecting it

thanks to anyone who helps

local turretSpeed  = 200 -- studs per second
local detectionRange = 300 -- how close will the turret activate


while wait(2) do

	for i,turret in pairs(game.Workspace:GetDescendants()) do
		if turret.Name == "LaserTurret" and math.random(1,2) == 1 then

			-- calculate closest part --
			--------------------------------------------------------------------------
			local closest = math.huge
			local closestPart = game.Workspace.Turrets.TurretCalibrate
			for i,part in pairs(game.Workspace:GetDescendants()) do				
				if part:FindFirstChild("TurretTag") then
					if (turret.Position - closestPart.Position).Magnitude < closest then
						closest = (turret.Position - closestPart.Position).Magnitude
						closestPart = part
					end
				end
			end
			--------------------------------------------------------------------------

			if (turret.Position - closestPart.Position).Magnitude < detectionRange then
				game:GetService("TweenService"):Create(turret,TweenInfo.new(.2,Enum.EasingStyle.Quad),{CFrame = CFrame.new(turret.Position,closestPart.Position) * CFrame.Angles(math.rad(90),turret.Position.Y,math.rad(90))}):Play()
				wait(.2)
				spawn(function()
					turret.Attachment.WorldPosition = turret.Position
					turret.Attachment2.WorldPosition = turret.Position

					turret.Blast:Play()
					game:GetService("TweenService"):Create(turret.Looping,TweenInfo.new(.45),{Volume = 1}):Play()
					game:GetService("TweenService"):Create(turret.Attachment2,TweenInfo.new((turret.Position - closestPart.Position).Magnitude/turretSpeed),{WorldPosition = -turret.CFrame.RightVector * 500}):Play()

-- ^^^^^ PROBLEM IS MOST LIKELY HERE AS INCREASING 500 MAKES THE ACCURACY BETTER (but i dont want it to go too far as there's obviously a range)


					wait((turret.Position - closestPart.Position).Magnitude/turretSpeed)
					--calculateHitCast(turret.Position,closestPart.Position)
					wait(.05)
					game:GetService("TweenService"):Create(turret.Attachment,TweenInfo.new(((turret.Position - closestPart.Position).Magnitude/turretSpeed)/2),{WorldPosition = turret.Attachment2.WorldPosition}):Play()
					game:GetService("TweenService"):Create(turret.Looping,TweenInfo.new(.45),{Volume = 0}):Play()
					wait(((turret.Position - closestPart.Position).Magnitude/turretSpeed))

					turret.Attachment.WorldPosition = turret.Position
					turret.Attachment2.WorldPosition = turret.Position
				end)
			end
		end
	end
end

function calculateHitCast(pos1,pos2)
	-- stuff here
end

After further testing, the turret rotation is correct, but the attachment is not going in the correct direction with the lookvector (or rightvector in this case) of the actual turret. Hope that helps.