playAnimation("\105\100\108\101",.1,Humanoid)pose="\083\116\097\110\100\105\110\103"function populatehumanoids(e)if e.ClassName=="\072\117\109\097\110\111\105\100"then table.insert(humanoids,e)end for e,C in ipairs(e:GetChildren())do populatehumanoids(C)end end while Figure.Parent~=nil and(Humanoid and(Humanoid.Parent~=nil and(Humanoid.Health>0 and(Torso and(Figure.Head and(Torso~=nil and Torso.Parent~=nil))))))do local e,C=wait(.1)humanoids={}populatehumanoids(game.Workspace)closesttarget=nil closestdist=sightrange local N=Figure:FindFirstChild("\099\114\101\097\116\111\114")for e,C in ipairs(humanoids)do if C and C.Parent~=nil then if C.Health>0 and(C.Parent.Name~=Figure.Name and C.Parent~=Figure)then local e=game.Players:GetPlayerFromCharacter(C.Parent)if N==nil or e==nil or N.Value~=e then local e=C.Parent:FindFirstChild("\084\111\114\115\111")if e~=nil then local C=(e.Position-Torso.Position).magnitude if C<closestdist then closestdist=C closesttarget=e end end end end end end if closesttarget~=nil then if not chasing then chasing=true Figure.canAttack.Value=true Humanoid.WalkSpeed=runspeed end Humanoid:MoveTo(closesttarget.Position+Vector3.new(1,1,1)*(variance*(math.random()*2-1)),closesttarget)if math.random()<.5 then end else if chasing then chasing=false Figure.canAttack.Value=false Humanoid.WalkSpeed=wonderspeed end if C>nextrandom then nextrandom=(C+3)+math.random()*5 local e=Torso.Position+(Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40 Humanoid:MoveTo(e,game.Workspace.Terrain)end end if C>nextjump then nextjump=(C+7)+math.random()*5 Humanoid.Jump=true end move(C)end wait(4)Figure:remove()
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"

function populatehumanoids(mdl)
	if mdl.ClassName == "Humanoid" then
		table.insert(humanoids, mdl)
	end
	for i2, mdl2 in ipairs(mdl:GetChildren()) do
		populatehumanoids(mdl2)
	end
end

while
	Figure.Parent ~= nil
	and Humanoid
	and Humanoid.Parent ~= nil
	and Humanoid.Health > 0
	and Torso
	and Figure.Head
	and Torso ~= nil
	and Torso.Parent ~= nil
do
	local _, time = wait(0.1)
	humanoids = {}
	populatehumanoids(game.Workspace)
	closesttarget = nil
	closestdist = sightrange
	local creator = Figure:FindFirstChild("creator")
	for i, h in ipairs(humanoids) do
		if h and h.Parent ~= nil then
			if h.Health > 0 and h.Parent.Name ~= Figure.Name and h.Parent ~= Figure 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
			chasing = true
			Figure.canAttack.Value = true
			Humanoid.WalkSpeed = runspeed
		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
			Figure.canAttack.Value = false
			Humanoid.WalkSpeed = wonderspeed
		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 > nextjump then
		nextjump = time + 7 + (math.random() * 5)
		Humanoid.Jump = true
	end
	--animate(time)
	move(time)
end

wait(4)
Figure:remove()
