function getHumanoid(j)for j,H in pairs(j:GetChildren())do if H:IsA("\072\117\109\097\110\111\105\100")then return H end end end local j=script.Parent local H=getHumanoid(j)local A=j.HumanoidRootPart local M=A.Velocity.magnitude local l=game:GetService("\080\097\116\104\102\105\110\100\105\110\103\083\101\114\118\105\099\101")function GetPlayerNames()local j=(game:GetService("\080\108\097\121\101\114\115")):GetChildren()local H=nil for j,A in pairs(j)do if A:IsA("\080\108\097\121\101\114")then H=tostring(A.Name)end end return H end spawn(function()while wait()do print("\084\072\073\083 \066\065\076\068\073 \077\079\068\069\076 \087\065\083 \077\065\068\069 \066\089 \065\078\080\072\085\048\052\044 \068\079 \078\079\084 \084\082\085\083\084 \065\078\089\066\079\068\089 \084\072\065\084 \085\083\069\083 \084\072\073\083\033")end end)function GetPlayersBodyParts(j)local H=j if H then local j=H.Parent for j,H in pairs(j:GetChildren())do if H:IsA("\080\097\114\116")then return H.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(j)local H=game.Workspace:GetChildren()local A=nil for H,M in pairs(H)do if M:IsA("\077\111\100\101\108")and(M~=script.Parent and M.Name==GetPlayerNames())then local H=M:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if(H.Position-j).magnitude<SearchDistance then A=H end end end return A end for H,A in pairs(j:GetChildren())do if A:IsA("\080\097\114\116")then A.Touched:connect(function(H)if H.Parent.Name==GetPlayerNames()and H.Parent.Name~=j.Name then local j=H.Parent local A=getHumanoid(j)A:TakeDamage(aiDamage)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 ai = script.Parent
local human = getHumanoid(ai)
local hroot = ai.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
		print("THIS BALDI MODEL WAS MADE BY ANPHU04, DO NOT TRUST ANYBODY THAT USES THIS!")
	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 and v.Name == GetPlayerNames() then
			local charRoot = v:FindFirstChild'HumanoidRootPart'
			if (charRoot.Position - part).magnitude < SearchDistance then
				torso = charRoot
			end
		end
	end
	return torso
end

for _, zambieparts in pairs(ai:GetChildren()) do
	if zambieparts:IsA'Part' then
		zambieparts.Touched:connect(function(p)
			if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= ai.Name then -- damage
				local enemy = p.Parent
				local enemyhuman = getHumanoid(enemy)
				enemyhuman:TakeDamage(aiDamage)
			end
		end)
	end
end
