It shouldn't stop, that always 5 enemys are here.
Yes, max_enemy_count is a local var.
Your random script functions, but now I have a very big swarm with 144566 enemys...

The script should always run, because I want endless 5 enemys. Enemy_count controls the count of the enemies and max_enemy_count controls the maximal count of enemies.