recently setkeyvalues havent been working. but heres a simple design
var coins = 0 ;
//makes the coins equal to score if score has been used before, or makes score equal to zero
getKeyValue(encodeURIComponent(getUserId())+ "score",function(score){
if(score == undefined){
setKeyValue(encodeURIComponent(getUserId())+ "score",0);
} else {
coins = score;
}
} );
function draw() {
//continously updates the key value
getKeyValue(encodeURIComponent(getUserId())+ "score",function(score){
setKeyValue(encodeURIComponent(getUserId())+ "score",coins);
} );
}