Here is an example of what I think you are trying to achieve. Of course this is just an example and not the code written for you.
<button id="save10">Save 10</button>
<button id="save12">Save 12</button>
var highscore = 11,
button10 = document.getElementById("save10"),
button12 = document.getElementById("save12"),
savedHighscore;
function saveData(x) {
localStorage.setItem('highscore', x);
}
button10.addEventListener("click", function () {
saveData(10);
}, false);
button12.addEventListener("click", function () {
saveData(12);
}, false);
savedHighscore = parseInt(localStorage.getItem('highscore'), 10);
if (typeof savedHighscore === "number" && highscore < savedHighscore) {
highscore = savedHighscore;
}
alert("Highscore: " + highscore);
On jsfiddle
Use the buttons to set the highscore, either 10 or 12. Refresh page, or hit run(only simulates a refresh). The user always scores 11 and it will alert either 11 or 12 depending on the saved highscore.