Help with a walking NPC rotating towards a player causing a brief freeze every time it is ran

  1. What do you want to achieve? Keep it simple and clear!

I want to tweak a script I have that causes an issue with a brief freeze in my NPC walking.

  1. What is the issue? Include screenshots / videos if possible!

I’ve been stuck on a line of code I use to tweak the NPC to turn to an aggro’d player while the NPC is walking using cframe:lerp. This does work but it causes an issue that i’ve been trying to search and fix for a few hours now, the issue being that the NPC briefly freezes, before continuing to walk. The script runs on a server script for those wondering.
Here’s the part of the code I use to turn the NPC

local function CfLerpHRP(TheHumanoidPart, TheAggroPlayer) -- Unrelated, but activates using task.spawn
	while true do
		task.wait(1) -- Originally was 0.07, but changed to 1 second to make the brief freezing more visual on the video.
		TheHumanoidPart.CFrame = TheHumanoidPart.CFrame:Lerp(CFrame.new(TheHumanoidPart.CFrame.Position, TheAggroPlayer.Character.Torso.Position), 0.2)
	end
end

I’ve used other alternatives, such as AlignOrientation which sort-of works but causes the NPC to look up if the player is somewhere high, which I don’t want it to.

A weird thing I’ve found out is that the brief freezing only becomes a problem when I want to rotate an NPC, and not it’s position.

How can I fix this? Is slightly rotating an NPC inevitable with a brief freeze on Roblox?

Try using humanoid:MoveTo(point), and updating the point in the loop instead.

Sorry but I already have a NPC system set up where it navigates to the player. I’m more concerned about the NPC facing the player, not where it’s walking to.

A note I forgot to put in but I’ve disabled AutoRotate on the humanoid on purpose in favor of this script.