You can't really protect your game from hackers, the best you can do is make their job harder.
I'll quote my answer from a similar post:
You can keep your score hashed at all times. Check if the hash is correct before adding points or submitting the score.
Or keep track of the score in 2 different variables - one in clear form and another in some encrypted/obscure format. (Multiplied by 3.14, converted to text, written backwards etc.)
Display the clear variable in your game and don't check its integrity, allow the hacker to change it. But when it's time to submit the highscore, de-crypt the other variable and upload it.