task.spawn(function()while true do if Dead then break end AI()local F,u,A=near()if F and not Dead then F=F.p if not r then w=.14 local u=h.Position-F local A,l=workspace:FindPartOnRay(Ray.new(t.Torso.Position,(F-t.Torso.Position).Unit*999),t)if A and not Dead then local F,u=CheckForHumanoid(A)if F==true and(u.Health>0 and(game.Players:GetPlayerFromCharacter(u.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)
--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 = 0.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 - 0.25
					end
					--print(Memory)
				end
				task.wait(5)
			end
		end
	end
end)
