ah i did something like this a while back
var Highscore1;
var Highscore2;
var Highscore3;
var Highscore4;
var Highscore5;
var Highscore2;
var Highscore6;
var Highscore7;
var Highscore8;
var Highscore9;
var Highscore10;
getKeyValue("highscore1", function(highscore1){
if(highscore1 == undefined){
setKeyValue("highscore1", 120);
}
Highscore1 = highscore1;
});
getKeyValue("highscore2", function(highscore2){
if(highscore2 == undefined){
setKeyValue("highscore2", 110);
}
Highscore2 = highscore2;
});
getKeyValue("highscore3", function(highscore3){
if(highscore3 == undefined){
setKeyValue("highscore3", 100);
}
Highscore3 = highscore3;
});
getKeyValue("highscore4", function(highscore4){
if(highscore4 == undefined){
setKeyValue("highscore4", 90);
}
Highscore4 = highscore4;
});
getKeyValue("highscore5", function(highscore5){
if(highscore5 == undefined){
setKeyValue("highscore5", 80);
}
Highscore5 = highscore5;
});
getKeyValue("highscore6", function(highscore6){
if(highscore6 == undefined){
setKeyValue("highscore6", 70);
}
Highscore6 = highscore6;
});
getKeyValue("highscore7", function(highscore7){
if(highscore7 == undefined){
setKeyValue("highscore7", 60);
}
Highscore7 = highscore7;
});
getKeyValue("highscore8", function(highscore8){
if(highscore8 == undefined){
setKeyValue("highscore8", 50);
}
Highscore8 = highscore8;
});
getKeyValue("highscore9", function(highscore9){
if(highscore9 == undefined){
setKeyValue("highscore9", 40);
}
Highscore9 = highscore9;
});
getKeyValue("highscore10", function(highscore10){
if(highscore10 == undefined){
setKeyValue("highscore10", 30);
}
Highscore10 = highscore10;
});
//start of draw function
function draw() {
fill("white");
textSize(16);
text("" + username, sprite.x + joke, sprite.y - 0);
text("username: " + username, sprite9.x - 188, sprite9.y + 195);
text("coins: " + coins, sprite9.x - 188, sprite9.y - 178);
text("1. " + Highscore1, sprite9.x + 130, sprite9.y - 175);
text("2. " + Highscore2, sprite9.x + 130, sprite9.y - 160);
text("3. " + Highscore3, sprite9.x + 130, sprite9.y - 145);
text("4. " + Highscore4, sprite9.x + 130, sprite9.y - 130);
text("5. " + Highscore5, sprite9.x + 130, sprite9.y - 115);
text("6. " + Highscore6, sprite9.x + 130, sprite9.y - 100);
text("7. " + Highscore7, sprite9.x + 130, sprite9.y - 85);
text("8. " + Highscore8, sprite9.x + 130, sprite9.y - 70);
text("9. " + Highscore9, sprite9.x + 130, sprite9.y - 55);
text("10. " + Highscore10, sprite9.x + 130, sprite9.y - 40);
movement_in_the_leader_board();
}
//end of draw function
//start of movement_in_leader_board
function movement_in_the_leader_board() {
if (coins > Highscore1) {
Highscore1 = username;
level = 1;
}
if (coins > Highscore2 && level > 2) {
Highscore2 = username;
level = 2;
}
if (coins > Highscore3 && level > 3) {
Highscore3 = username;
level = 3;
}
if (coins > Highscore4 && level > 4) {
Highscore4 = username;
level = 4;
}
if (coins > Highscore5 && level > 5) {
Highscore5 = username;
level = 5;
}
if (coins > Highscore6 && level > 6) {
Highscore6 = username;
level = 6;
}
if (coins > Highscore7 && level > 7) {
Highscore7 = username;
level = 7;
}
if (coins > Highscore8 && level > 8) {
Highscore8 = username;
level = 8;
}
if (coins > Highscore9 && level > 9) {
Highscore9 = username;
level = 9;
}
if (coins > Highscore10 && level > 10) {
Highscore10 = username;
level = 10;
}
}
idk if this works though