task.defer(function()while true do task.wait(.25)for N,f in ActiveMobs do task.spawn(function()if not f.isDead and not f.Destroyed then local z,j=AI:GetClosestPlayer(f)local t=f.Enemy if f.Root.Anchored then f.Root.Anchored=false end if not f.Root:GetNetworkOwner()then f.Root:SetNetworkOwner(z)task.wait(.05)end if z and t then t:MoveTo((z.Character:GetPivot()).Position,z.Character.PrimaryPart)else ActiveMobs[N]=nil f.Root:SetNetworkOwner()t:MoveTo(f.Origin.Position)end AI:RequestJump(f)else ActiveMobs[N]=nil end end)end end end)return AI
-- Code to continue tracking & jumping on Active Mobs
task.defer(function()
	while true do
		task.wait(1 / 4)
		for MobInstance, Mob in ActiveMobs do
			task.spawn(function()
				if not Mob.isDead and not Mob.Destroyed then
					local Player, m = AI:GetClosestPlayer(Mob)
					local Enemy = Mob.Enemy

					-- Simulation
					if Mob.Root.Anchored then
						Mob.Root.Anchored = false
					end
					if not Mob.Root:GetNetworkOwner() then
						Mob.Root:SetNetworkOwner(Player)
						task.wait(0.05) -- Give physics more time so it doesn't appear as choppy
					end

					-- Tracking
					if Player and Enemy then
						Enemy:MoveTo(Player.Character:GetPivot().Position, Player.Character.PrimaryPart)
					else
						ActiveMobs[MobInstance] = nil
						Mob.Root:SetNetworkOwner()
						Enemy:MoveTo(Mob.Origin.Position)
					end

					-- Jumping
					AI:RequestJump(Mob)
				else
					ActiveMobs[MobInstance] = nil
				end
			end)
		end
	end
end)

return AI
