local E local F local S=nil function GetTorso(E)local F=game.Workspace:GetDescendants()local Y=nil local X=nil local r=nil local B=nil local A=SearchDistance for o=1,#F,1 do r=F[o]if r:IsA("\077\111\100\101\108")and(not r:FindFirstChild("\069\110\101\109\121")and not r:FindFirstChild("\072\101\108\112\101\114"))then B=getHumanoid(r)Y=r:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if Y~=nil and(B~=nil and(B.Health>0 and(not B:FindFirstChild("\069\110\101\109\121")and not r:FindFirstChild("\072\101\108\112\101\114"))))then if(Y.Position-E).magnitude<A then S=r.Name X=Y A=(Y.Position-E).magnitude end end end end return X end function GetPlayersBodyParts(E)local F=E if F then local E=F.Parent for E,F in pairs(E:GetChildren())do if F:IsA("\080\097\114\116")then return F.Name end end else return"\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"end end


local path
local waypoint

local chaseName = nil

function GetTorso(part)
	local chars = game.Workspace:GetDescendants()
	local chaseRoot = nil
	local chaseTorso = nil
	local chasePlr = nil
	local chaseHuman = nil
	local mag = SearchDistance
	for i = 1, #chars do
		chasePlr = chars[i]
		if chasePlr:IsA'Model' and not chasePlr:FindFirstChild("Enemy") and not chasePlr:FindFirstChild("Helper") then
			chaseHuman = getHumanoid(chasePlr)
			chaseRoot = chasePlr:FindFirstChild'HumanoidRootPart'
			if chaseRoot ~= nil and chaseHuman ~= nil and chaseHuman.Health > 0 and not chaseHuman:FindFirstChild("Enemy") and not chasePlr:FindFirstChild("Helper") then
				if (chaseRoot.Position - part).magnitude < mag then
					chaseName = chasePlr.Name
					chaseTorso = chaseRoot
					mag = (chaseRoot.Position - part).magnitude
				end
			end
		end
	end
	return chaseTorso
end

function GetPlayersBodyParts(t)
	local torso = t
	if torso then
		local figure = torso.Parent
		for _, v in pairs(figure:GetChildren())do
			if v:IsA'Part' then
				return v.Name
			end
		end
	else
		return "HumanoidRootPart"
	end
end
