How to add value just once in void OnGUI()

Hi i have got sth like this

 void OnGUI()
    {

        if (end == 1) {
			
			NGUITools.SetActive(PanelWon, true);
			score ++;
                        Time.timeScale = 0.0f
		}

}

When the “PanelWon” is active it adds 1 score every second (frame), i want to add just 1 score so when i won i have got +1 score. Another thing, when i won the same game again one star score stays there so it doesn’t add it again and again when i play (win) the same level every time.

add a second boolean variable like hasScoreAdded and the then check for that as well when adding the score. Set it to true once the score is added so it only adds once. Then remember to reset it when you exit the if the condition.

You really should not be using OnGUI to add score. Bad practice.

Why not have a function you call to add to the score variable and call that when you need to add score. You must set the end boolean somewhere, so why not just call a function there aswell to add the score?