Increment on button click

Okay I have a textbox that keeps the score of a game.

Now what i want is when the user clicks on a button, for the score to be incremented by 1, but i want it so that when it reaches 10, that the game terminates.

at the moment I have the following code on my button

on (release){
for (counter=0;counter<10;++counter);
}

But this doesn’t seem to work, i have given my textbox a variable name counter.

Can anyone help me?