local O=pfs:CreatePath()local w local h local M function findNearestTorso(O)local w=game.Workspace:children()local h=nil local M=Settings.WalkDistance.Value local j=nil local i=nil local B=nil for C=1,#w,1 do B=w[C]if B.className=="\077\111\100\101\108"and B~=script.Parent then j=B:findFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")i=B:findFirstChild("\072\117\109\097\110\111\105\100")if j~=nil and(i~=nil and(i.Health>0 and players:GetPlayerFromCharacter(i.Parent)~=nil))then if(j.Position-O).magnitude<M then h=j M=(j.Position-O).magnitude end end end end return h end

local path = pfs:CreatePath()
local waypoint
local currentWaypointIndex
local target

function findNearestTorso(pos)
	local list = game.Workspace:children()
	local torso = nil
	local dist = Settings.WalkDistance.Value
	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("HumanoidRootPart")
			human = temp2:findFirstChild("Humanoid")
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and players:GetPlayerFromCharacter(human.Parent)~= nil then
				if (temp.Position - pos).magnitude < dist then
					torso = temp
					dist = (temp.Position - pos).magnitude
				end
			end
		end
	end
	return torso
end

