You are comparing apples and oranges. You check if TotalDistance is > HighScore, but then divide TotalDistance by 10, so the next time HighScore is always going to be 1/10 of TotalScore. Use a local variable to set CurrentScore = round(TotalDistance/10) then compare CurrentScore > HighScore, and save CurrentScore.