The question really says it all. I've seen solutions to this issue on the Dev Forum and I've edited the script to what they said to do but it didn't work. That's really it, any help would be great! Thank you!

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)

while script.Parent.Humanoid.Health < 1000 do
	script.Parent.Humanoid.Health = 1000
end