while sp.Parent~=nil and(Humanoid and(Humanoid.Parent~=nil and(Humanoid.Health>0 and(Torso and(Head and(Torso~=nil and Torso.Parent~=nil))))))do local z,h=wait(.25)humanoids={}populatehumanoids(game.Workspace)closesttarget=nil closestdist=sightrange local U=sp:FindFirstChild("\099\114\101\097\116\111\114")for z,h in ipairs(humanoids)do if h and h.Parent~=nil then if h.Health>0 and h.Parent~=sp then local z=game.Players:GetPlayerFromCharacter(h.Parent)if U==nil or z==nil or U.Value~=z then local z=h.Parent:FindFirstChild("\084\111\114\115\111")if z~=nil then local h=(z.Position-Torso.Position).magnitude if h<closestdist then closestdist=h closesttarget=z end end end end end end if closesttarget~=nil then if not chasing then chasing=true Humanoid.WalkSpeed=runspeed BARKING:Play()end Humanoid:MoveTo(closesttarget.Position+Vector3.new(1,1,1)*(variance*(math.random()*2-1)),closesttarget)if math.random()<.5 then attack(h,closesttarget.Position)end else if chasing then chasing=false Humanoid.WalkSpeed=wonderspeed BARKING:Stop()end if h>nextrandom then nextrandom=(h+3)+math.random()*5 local z=Torso.Position+(Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40 Humanoid:MoveTo(z,game.Workspace.Terrain)end end if h>nextsound then end if h>nextjump then nextjump=(h+7)+math.random()*5 Humanoid.Jump=true end animate(h)end wait(4)sp:remove()
--[[function playsound(time)
	nextsound=time+5+(math.random()*5)
	local randomsound=sounds[math.random(1,#sounds)]
	randomsound.Volume=.5+(.5*math.random())
	randomsound.Pitch=.5+(.5*math.random())
	randomsound:Play()
end]]

while
	sp.Parent ~= nil
	and Humanoid
	and Humanoid.Parent ~= nil
	and Humanoid.Health > 0
	and Torso
	and Head
	and Torso ~= nil
	and Torso.Parent ~= nil
do
	local _, time = wait(0.25) --wait(1/3)
	humanoids = {}
	populatehumanoids(game.Workspace)
	closesttarget = nil
	closestdist = sightrange
	local creator = sp:FindFirstChild("creator")
	for i, h in ipairs(humanoids) do
		if h and h.Parent ~= nil then
			if h.Health > 0 and h.Parent ~= sp then
				local plr = game.Players:GetPlayerFromCharacter(h.Parent)
				if creator == nil or plr == nil or creator.Value ~= plr then
					local t = h.Parent:FindFirstChild("Torso")
					if t ~= nil then
						local dist = (t.Position - Torso.Position).magnitude
						if dist < closestdist then
							closestdist = dist
							closesttarget = t
						end
					end
				end
			end
		end
	end
	if closesttarget ~= nil then
		if not chasing then
			--playsound(time)
			chasing = true
			Humanoid.WalkSpeed = runspeed
			BARKING:Play()
		end
		Humanoid:MoveTo(
			closesttarget.Position + (Vector3.new(1, 1, 1) * (variance * ((math.random() * 2) - 1))),
			closesttarget
		)
		if math.random() < 0.5 then
			attack(time, closesttarget.Position)
		end
	else
		if chasing then
			chasing = false
			Humanoid.WalkSpeed = wonderspeed
			BARKING:Stop()
		end
		if time > nextrandom then
			nextrandom = time + 3 + (math.random() * 5)
			local randompos = Torso.Position + (
					(Vector3.new(1, 1, 1) * math.random() - Vector3.new(0.5, 0.5, 0.5)) * 40
				)
			Humanoid:MoveTo(randompos, game.Workspace.Terrain)
		end
	end
	if time > nextsound then
		--playsound(time)
	end
	if time > nextjump then
		nextjump = time + 7 + (math.random() * 5)
		Humanoid.Jump = true
	end
	animate(time)
end

wait(4)
sp:remove() --Rest In Pizza
