Creating leaderboards with saved variables
-
How do you put a variable into the leaderboard/change the top number in the leaderboard with the variable the player got?
-
Currently, you can use this block to submit a new value for the current user, which will overwrite the old value if the new value is better:
-
@info-creaticode Is this a premium block? I can’t find it in the game and the AI won’t give it to me.
-
It is in the “Game” extension.
-
@info-creaticode I’m sorry, but I can’t find the game extension. What are you referring to? If the extensions are the tabs like the sound and motion ones, I don’t see the game one on there.
-
-
@info-creaticode It seems that XO (as shown in the image above) gives blocks but probably in the wrong syntax so it falls back to making a comment block lke “// record player score” which isn’t the same as the actual block “record player score”.
-
@info-creaticode I figured it out, thank you
-
@info-creaticode How do you create multiple leaderboards for different things?
-
@011830-0a42ef84 i believe there is only one leaderboard per game, use a server saved table/database instead that will save user IDs and stats
-
@jeffreyrb03-gmail can you help me with that and give me an example? I tried it but I didn’t know how
-
@011830-0a42ef84 using databases is a tiny bit tricky, but they are basically just tables with strict/enforced columns with types (like number, string, or date) and allow you to store rows in them. It is pretty transaction based kinda like actual databases. For a leaderboard you just need to create a database for a leaderboard, and to get data from it, just display say around 100 rows where a stat like coins is greatest, if you were to show some leaderboard of users with the most coins.
I’ll let you tinker around with that first and if you still need help then I would like to see your code and I’ll give working code. I do have a project that demonstrates how to use a database, you’ll have to look in the code though, and what it does it just check if a password you enter is the correct password by asking the database for the password and then checking if the inputted password is equal to the password from the database:
the project is in unlisted shared so u can see it
https://play.creaticode.com/projects/66f85f2ce228c74a133e1128
Hopefully my project doesn’t confuse you more, but all you have to do is just change it up and delete the stuff leftover from my challenge thingie. Instead of using the database to store one singular piece of text, you can use it to store multiple rows like a table and in the end, you could use that database to make a leaderboard of your own and shows what you want.The columns it should be storing are (user id), found in Sensing, and then any variables.