'AI gets stuck when generating too much AI

I use for loop to spawn a lot of monsters but when I spawn too many monsters they will get stuck... how can I fix it? Red circle is the AI which getting stuck



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source