int changed only once, when player pass the level

I’m awarding my players 20 coins if he score 100 points in current level. I’m trying to put this values to Playerprefs so when player play come back to this level, and reach again 100 points, no coins would be given, as he already got the reward. Can’t figure out this.

I have multiple levels & multiple score outcomes. But wouldn’t like player to comeback to LEVEL1 (easy one) and keep getting coins for completing it over and over again.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public GameObject Level1Completed;

public GameObject LevelWindowBackground;
public GameObject burst;

bool levelFinished = false;

public GameObject menuContainer;
public GameObject spawnBallBtn;
public GameObject restartGameBtn;

bool coins100 = false;

// Start is called before the first frame update
void Start()

    coins100 = (PlayerPrefs.GetInt("coins100") != 1);


void Update()

    if (!GameOver.gameHasEnded && Score.scoreValue <= -50)

        Invoke("waitforSec", 1f);

        GameOver.gameHasEnded = true;


    if (Score.scoreValue >= 50)


        if (!levelFinished )

            levelFinished = true;

              switch (Score.scoreValue)


                  case 100:

                    Invoke("threeStars", 1f);

                    if (!coins100)
                        Debug.Log("Got 20 Coins already");
                        CoinsCount.coinsValue += 20;
                        gemsCount.gemsValue += 1;
                        Tries.tries += 3;
                        LevelComnpletedCoins.CoinsWon = 20;
                        LevelCompletedGems.GemsWon = 1;

                        coins100 = true;
                        PlayerPrefs.SetInt("coins100", (coins100 ? 1 : 0));


Just create some tokens for each level and set an integer value for it to indicate if the level was already completed or not.

So if PlayerPrefs.getInt("Level1Completed") == 1 then you do not reward coins.
And if you reward coins you also do PlayerPrefs.setInt("Level1Completed") = 1 to set the flag that you already rewarded coins once.

let me know if something was unclear.