Need help displaying scores.

Someone’s going to probably laugh at this and I don’t blame them but I can’t get the high score to update live in game.

I have this
storyboard.state = {score = 0}
score = display.newText(storyboard.state.score, 250, 20, “ARIAL”, 16)
Then this
storyboard.state.score = storyboard.state.score + 1

It’s working but not showing up live in the game…
Anyways I have been trying stuff all day and figured I’d ask. I just want to complete this extremely basic score system

Thanks for reading this :slight_smile:

So you have two things going on:

  • There is the variable storyboard.state.score

  • There is the display object called score

This line: 

storyboard.state.score = storyboard.state.score + 1 

Is updating the variable, but not the display object. So after this line you will want to write:

score.text = storyboard.state.score

It worked! Thank you so much :smiley:

So you have two things going on:

  • There is the variable storyboard.state.score

  • There is the display object called score

This line: 

storyboard.state.score = storyboard.state.score + 1 

Is updating the variable, but not the display object. So after this line you will want to write:

score.text = storyboard.state.score

It worked! Thank you so much :smiley: