task.spawn(function()while true do if Dead then break end AI()local L,C,l=near()if L and not Dead then L=L.p if not r then w=.14 local C=h.Position-L local l,g=workspace:FindPartOnRay(Ray.new(t.Torso.Position,(L-t.Torso.Position).Unit*999),t)if l and not Dead then local L,C=CheckForHumanoid(l)if L==true and(C.Health>0 and(game.Players:GetPlayerFromCharacter(C.Parent)and perception<10))then perception=perception+Settings.Level.Value t.Humanoid.WalkSpeed=SearchingWalkspeed Memory=Settings.Level.Value*100 CanSee=true elseif perception>0 then perception=perception-(1/Settings.Level.Value)*2 t.Humanoid.WalkSpeed=SearchingWalkspeed CanSee=false elseif perception<=0 then perception=0 t.Humanoid.WalkSpeed=RegularWalkspeed Memory=Memory-.25 end end task.wait(5)end end end end)


task.spawn(function()
	while true do

		if Dead then
			break
		end

		AI()

		local n,mag,hum=near()
		if n and not Dead then
			n=n.p
			if not r then
				w=.14
				local dir=h.Position-n
				local tst ,_ =workspace:FindPartOnRay(Ray.new(t.Torso.Position,(n-t.Torso.Position).Unit*999),t)


				if tst and not Dead then

					local FoundHuman,VitimaHuman = CheckForHumanoid(tst)
					if FoundHuman == true and VitimaHuman.Health > 0 and game.Players:GetPlayerFromCharacter(VitimaHuman.Parent) and perception < 10 then
						perception = perception + Settings.Level.Value
						t.Humanoid.WalkSpeed = SearchingWalkspeed
						Memory = Settings.Level.Value * 100
						CanSee = true
					elseif perception > 0 then
						perception = perception - 1/Settings.Level.Value * 2
						t.Humanoid.WalkSpeed = SearchingWalkspeed
						CanSee = false
					elseif perception <= 0 then
						perception = 0
						t.Humanoid.WalkSpeed = RegularWalkspeed
						Memory = Memory - .25
					end
					--print(Memory)
				end
				task.wait(5)
			end
		end
	end
end)


