I've seen many places where this has been an issue, and I've attempted to fix it by changing the script a lot but it still stutters every time you turn or start walking in a different direction, so I can't seem to figure out why it is doing that, any help would be great, thanks!

local RunService = game:GetService("RunService")
local PathFindingService = game:GetService("PathfindingService")
local Debounce = false	
local FollowingPath = PathFindingService:CreatePath()
function findNearestTorso(pos)
    local list = game.Workspace:children()
    local torso = nil
    local dist = 30
    local temp = nil
    local human = nil
    local temp2 = nil
    for x = 1, #list do
        temp2 = list[x]
        if (temp2.className == "Model") and (temp2 ~= script.Parent) then
            temp = temp2:findFirstChild("UpperTorso")
            human = temp2:findFirstChild("Humanoid")
            if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and game.Players:FindFirstChild(temp2.Name) then
                if (temp.Position - pos).magnitude < dist then
                    torso = temp
                    dist = (temp.Position - pos).magnitude
                end
            end
        end
		end
    return torso
end

RunService.Heartbeat:Connect(function()
    wait()
    local target = findNearestTorso(script.Parent.Torso.Position)
    if target ~= nil then
	FollowingPath:ComputeAsync(script.Parent.Torso.Position, target.Position)
	if FollowingPath.Status == Enum.PathStatus.Success then
	local Waypoints = FollowingPath:GetWaypoints()
	local distance
    for i = 1, #Waypoints do 
	script.Parent.Humanoid:MoveTo(Waypoints[i].Position)
	
	repeat
		distance = (Waypoints[i].Position - target.Position).magnitude 
		wait()
	until
	distance <= 30
	
end
    end
end
    end)