Trying to save and load highScore

So, I am having a problem when trying to save and load a highscore in my game…

In line 121: I get an error that highScore is a nil value

Can anyone help me figure out why?

Here is the code for my game: 

Thanks alot in advance for any help :slight_smile:

Hi, 

Could be just a logic issue.

In your onCollision function change

if highScore < counter then

to 

if highScore >= counter then

Good Luck!

burhan

I do not see your code

Hi, 

Could be just a logic issue.

In your onCollision function change

if highScore < counter then

to 

if highScore >= counter then

Good Luck!

burhan

I do not see your code