Turning Lerp script stops working the second the target isn't directly the player

My script should make it so that a boss turns towards the player at a fixed rate, this is the functional version of the script:

game:GetService("RunService").RenderStepped:Connect(function(delta)
	if 	apostle:GetAttribute("turn") == true then
		local frame = apostle.HumanoidRootPart
		local playerPosition = character.HumanoidRootPart.Position
		local target = CFrame.new(frame.Position,playerPosition)
		local dotProduct = (frame.CFrame.LookVector:Dot(target.LookVector)-1)*-1
		local distanceTravelled = delta*turnSpeed
		
		local alpha = distanceTravelled/dotProduct
		if alpha > 1 then
			alpha = 1
		end

		frame.CFrame = frame.CFrame:Lerp(target,alpha)
	end
end)

whenever i change the “target” line, to this:

local target = CFrame.new(frame.Position,Vector3.new(playerPosition.X,frame.Position.Y,playerPosition.Z))

The code doesn’t give any errors, but whenever used, the npc gets sent flying inexplicably.
The idea behind this change is that the boss shouldn’t follow the height of the player, since when you get too close, the boss tilts towards the player due to height differences