Turn towards target (cutscene)

I’m trying to make it so that the player character turns towards the NPC when it approaches. Currently the NPC hits the distance limit and the player character starts going crazy. Any help would be appreciated.

  • The plrbody variable is the HumanoidRootPart.

  • The prints show that it should be doing what I want it to do.

local Duration = 3
	local TurnFunc
	
	for _, waypoint in pairs(waypoints) do
		if (NFJbody.Position - plrbody.Position).magnitude >= 10 then
			hum:MoveTo(waypoint.Position)
			hum.MoveToFinished:Wait()
		else
			local CurrentAngle = plrbody.Orientation.y
			local ANGLE = NFJbody.Orientation.y + 180
			TurnFunc = game:GetService("RunService").Heartbeat:Connect(function(delta)
				print(CurrentAngle)
				print(ANGLE)
				print(NFJbody.Orientation.y)
				print(plrbody.CFrame)
				local adjustment = ANGLE*(delta/Duration)
				if CurrentAngle + adjustment < ANGLE then
					CurrentAngle += adjustment
				else
					CurrentAngle = ANGLE
					plrbody.Orientation = Vector3.new(0,math.rad(CurrentAngle),0)
					TurnFunc:Disconnect()
				end
				plrbody.Orientation = Vector3.new(0,math.rad(CurrentAngle),0)
			end)
		end
	end

You don’t need to calculate any fancy angles. This can be easily achieved with a basic CFrame constructor.

local npcPosition = Vector3.new(NFJbody.Position.X, plrBody.Position.Y, NFJbody.Position.Z)
plrBody.CFrame = CFrame.new(plrBody.Position, npcPosition)

I guess that’s the easiest solution, and you could make it incremental if you wanted. Still, I wonder why my code didn’t work.