Making character's head look at target primary part position

  1. What do you want to achieve? I have a system where when tower attacks it faces target and i wanna make the tower’s head look at the target primary part position and i wanna make that work with animations

  2. What is the issue? I tried to make it but i failed many times that i had to put everything back to normal

  3. What solutions have you tried so far? i looked i dev forum and there’s nothing similar to this

function tower.FaceTarget(newTower, target, duration)
	local targetVector = Vector3.new(target.PrimaryPart.Position.X, newTower.PrimaryPart.Position.Y, target.PrimaryPart.Position.Z)
	local targetCFrame = CFrame.new(newTower.PrimaryPart.Position, targetVector)

	local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
	local faceTargetTween = TweenService:Create(newTower.PrimaryPart, tweenInfo, {CFrame = targetCFrame})
	faceTargetTween:Play()
end

Hi. First of all, when you choose linear easing style, direction is not important, so you can just do

local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)

Now going to the solution. Please make sure your primary part is Anchored, all the other parts that shold be moving with primary part not anchored and are welded together. Can you check if primary part is moving? Please remember that moving the primarypart is not enough to move whole model.