How to call a function when something happens in the game once conditions are met?

I’m looking for solution to increment levels for my game. Logic should be like this:
When I get score of 3, transition starts and level becomes level 2, then when I get 6, cycle repeats. Currently I have something like this, but in this case I should make bool variables to play code once for passing each level which isn’t correct. How could this situation be solved?

    if (score.currentScore >= 3 && isPlayed == false)
        isPlayed = true;

Thank you!

You do it when your score goes up, like somewhere in your code you will have score.currentScore++ then right after that you put if (score.currentScore >= 3) then your make transition or whatever… also don’t use 3 use a vaiable, is it always going to be 3 more points to the next level? if so you should have if (score.currentScore >= level*pointsNeededToAdvance) or something like that, then you can use the same code for every level.