function getHumanoid(P)for P,O in pairs(P:GetChildren())do if O:IsA("\072\117\109\097\110\111\105\100")then return O end end end local P=script.Parent local O=getHumanoid(P)local Q=P.HumanoidRootPart local G=Q.Velocity.magnitude local v=game:GetService("\080\097\116\104\102\105\110\100\105\110\103\083\101\114\118\105\099\101")function GetPlayerNames()local P=(game:GetService("\080\108\097\121\101\114\115")):GetChildren()local O=nil for P,Q in pairs(P)do if Q:IsA("\080\108\097\121\101\114")then O=tostring(Q.Name)end end return O end spawn(function()while wait()do end end)function GetPlayersBodyParts(P)local O=P if O then local P=O.Parent for P,O in pairs(P:GetChildren())do if O:IsA("\080\097\114\116")then return O.Name end end else return"\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"end end function GetTorso(P)local O=game.Workspace:GetChildren()local Q=nil for O,G in pairs(O)do if G:IsA("\077\111\100\101\108")and G~=script.Parent then if G:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then local O=G:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if(O.Position-P).magnitude<SearchDistance then Q=O Ragdoll.Parent=Q.Parent Ragdoll.Disabled=false elseif not G:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then if G:FindFirstChild("\084\111\114\115\111")then local O=G:FindFirstChild("\084\111\114\115\111")if(O.Position-P).magnitude<SearchDistance then Q=O Ragdoll.Parent=Q.Parent Ragdoll.Disabled=false end end end end end end return Q end for O,G in pairs(P:GetChildren())do if G:IsA("\080\097\114\116")and G.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")then G.Touched:connect(function(O)if not O.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")then elseif(O.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")).Health==0 then elseif O.Parent.Name~=P.Name and(O.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")).Health>0 then local P=O.Parent local G=getHumanoid(P)G:TakeDamage(ZombieDamage)print("\100\101\100")Q.Death:Play()wait(6)Q.Death:Stop()end end)end end
--]]

function getHumanoid(model)
	for _, v in pairs(model:GetChildren()) do
		if v:IsA("Humanoid") then
			return v
		end
	end
end

local zombie = script.Parent
local human = getHumanoid(zombie)
local hroot = zombie.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude

local pfs = game:GetService("PathfindingService")

function GetPlayerNames()
	local players = game:GetService("Players"):GetChildren()
	local name = nil
	for _, v in pairs(players) do
		if v:IsA("Player") then
			name = tostring(v.Name)
		end
	end
	return name
end

spawn(function()
	while wait() do
	end
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

function GetTorso(part)
	local chars = game.Workspace:GetChildren()
	local torso = nil
	for _, v in pairs(chars) do
		if v:IsA("Model") and v ~= script.Parent then
			if v:FindFirstChild("HumanoidRootPart") then
				local charRoot = v:FindFirstChild("HumanoidRootPart")
				if (charRoot.Position - part).magnitude < SearchDistance then
					torso = charRoot
					Ragdoll.Parent = torso.Parent
					Ragdoll.Disabled = false
				elseif not v:FindFirstChild("HumanoidRootPart") then
					if v:FindFirstChild("Torso") then
						local charRoot = v:FindFirstChild("Torso")
						if (charRoot.Position - part).magnitude < SearchDistance then
							torso = charRoot
							Ragdoll.Parent = torso.Parent
							Ragdoll.Disabled = false
						end
					end
				end
			end
		end
	end
	return torso
end

for _, zambieparts in pairs(zombie:GetChildren()) do
	if zambieparts:IsA("Part") and zambieparts.Parent:FindFirstChildOfClass("Humanoid") then
		zambieparts.Touched:connect(function(p)
			if not p.Parent:FindFirstChildOfClass("Humanoid") then
			elseif p.Parent:FindFirstChildOfClass("Humanoid").Health == 0 then
			elseif p.Parent.Name ~= zombie.Name and p.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then -- damage
				local enemy = p.Parent
				local enemyhuman = getHumanoid(enemy)
				enemyhuman:TakeDamage(ZombieDamage)
				print("ded")
				hroot.Death:Play()
				wait(6)
				hroot.Death:Stop()
			end
		end)
	end
end
