Here is a clip of the error
Develop games in your browser. Powerful, performant & highly capable.
After you set spawnminion to a number, it stays at that number forever meaning that more minions get spawned every tick. Try setting it to an invalid number (-1 or maybe 0) immediately after you create a minion.