C# Do something every 100 points?

I have a score script that increases the score over time, but I am wondering how I could do an action on every 100 points, here is what I got so far:

   void FixedUpdate () {

		if (scoreTimer == true) {										
		
			scoreCount += 0.005f * speedUp.move;						
			scoreText.text = scoreCount.ToString ("F0");				
		}

		if (scoreTimer == false)										

		{
			scoreCount +=0.0f;											
			scoreText.text = scoreCount.ToString("F0");					
			PlayerPrefs.SetFloat("Player Score", scoreCount);			

		}

	}

I have looked around for solutions but not really sure where to start.

I thought about doing something like this:

if (scoreCount == 100) {

    "Do something"

{

But that wouldn’t update every 100 score only the first time.

Thanks in advance :slight_smile:

Given that you seem to be dealing with floats, or even if not then with scores that can increase by varying amounts, you can’t use direct comparison with 100 (or even the modulus: scoreCount % 100 == 0).

I would set a target score for the next action then increment the target each time it is reached.

float targetScore = 100;

void FixedUpdate() {
    ...
    if (scoreCount >= targetScore) {
        // Do something
        targetScore += 100;
    }
}