NPC Not rotating while Using Humanoid:MoveTo()

I’m currently making a NPC movement system but for some reason the NPC isn’t rotating its body when I use Humanoid:MoveTo() (Yes the NPCs Humanoid has autorotate on). After some debugging i found out that it was because of the NPC having a “RangeHitBox” part that detects if anything is inside its range. After changing the weld from a weld constraint to a motor6d, the NPC was now rotating and the bug was fixed. All I had to do was allign the part correctly since if I welded the parts using a script it will change the range hitbox part rotation. So I used this script


local rangeHitBox = RS.UnitHandler.RangeHitBox:Clone()
	rangeHitBox.Parent =  unit 
	rangeHitBox.Position = unit.HumanoidRootPart.Position
	rangeHitBox.Unit.Value = unit
	

	local weld = Instance.new("Motor6D", unit.HumanoidRootPart)

	
	weld.C0 = unit.HumanoidRootPart.CFrame:inverse() * rangeHitBox.CFrame
	weld.C1 = CFrame.new()
	
	weld.Part0 = unit.HumanoidRootPart
	weld.Part1 = rangeHitBox

Using this script the part was now alligned correctly, but one problem is that the NPC wasn’t rotating while moving problem came back. Does anyone know how to fix this? If anyone requests a video I’ll gladly record it.

Try searching the forums using the term ‘npc doesn’t rotate’.
I did and got a bunch of posts that might help you out.