for each loops with points increase

I have a game set up where enemies spawn at different locations. what i want to do is increase the speed in which they spawn as the players points increase. i’ve been told the best way to do this is by using a “for each loop” but I’m not sure how to implement it so that the speed increases for every 500 points the player earns.

Did you try an event (delegate) ?

You have a function “AddPoints”, do your maths,
and if it’s Points%500 > currentSpawRateFactor,
OnIncreasedSpawnRate.Broadcast() (I let you look at Delegates);

And your Enemy Manager (or EnemySpawners I don’t know), is listening to this delegate, and will react at the broadcast
so it will increase the spawnRate;

That is probably how I would deal with it. Probably a better solution exist;
The “currentSpeedFactor” is a bit blurry on how to do it, hopefully you will have a breakthrough