It chooses a colour then checks if the limit was reached for that colour, if not then it assigns that colour. If it hit the limit then it runs the function again, it'll keep running the function until it chooses a colour that hasn't hit the limit. The block at the top where it sets variable to 99 stops the function from looping forever when you create more orb objects than the limit so at that point it will just keep creating the grey default ones, for example in a scenario where you said no more than 3 can appear which would be 12 orbs and you decide to spawn 16 orbs, the last 4 will be grey.