Displaying and Sorting a Leaderboard

Hi, I’m very new to Thunkable and app-making in general. I’m only three days in, actually. I’ve tried searching extensively before posting this, so my apologies if the answer is somewhere else.

I’m trying to make a leaderboard that is generated from within the app itself. A user creates a score for an object, and as objects are created, I’d like to display a leaderboard that automatically sorts the objects in descending order with the highest score on top.

Can someone please point me in the right direction? Thank you so much. I’ve already learned a ton in the past two days from this community.

Hi @andetomrkzp, welcome to Thunkable!

Are you wanting to create a local leaderboard (high score list) that is limited to the device? Or do you want the leaderboard to include scores from other users on other devices as well?

1 Like

Thanks for the quick reply!

I want to create a local leaderboard limited to the device, at least for now.

Okay. That “for now” is important but if you use a list, as I suggest, you can later modify it to save data to Firebase and compare with other users’ scores.

The basic idea would be to create a stored variable that is an empty list. Then, when the user creates a score, you add the score to the list and sort the list. There are blocks for this in the List drawer. If you don’t know which to use, just ask. For multiple objects, use multiple lists.


Hmm, I’ve been trying to wrap my head around it and trying lots of different things, but I’m just not getting it. How do you add the user’s score to a list?

To add a value to a list and then sort the list, do this:

Obviously, you’d have to set the player score somewhere else first so it’s not just zero.

Lots more here: Thunkable On Air Episode 1: How to use Lists - YouTube


Thanks for that. Your post and that video were really helpful, but is there a way to have the object’s name sort along with its score? I’d like to show one column with the scores and next to that a column with the names of the objects.

I’ve also learned a lot from Darren’s How to Sort a List of Objects video, but I can only make it work with a stored variable like his “INITIAL_LIST” example. I can’t figure out how to create an object with fields where those fields are variables themselves. It just gives me an error message. I know there’s an answer somewhere between your suggestions and Darren’s video, but I can’t figure it out yet.

Yeah, @darren’s videos are great.

For creating a pair of values (name+score), I’d probably use two lists. If you need more fields than that (e.g. name+score+price+size), I’d usually start using a data source at that point. With two lists, you’d have to get a little creative about sorting the “name” list because you can’t sort it the same way. That’s where sorting a spreadsheet makes things easier, I think.

I really haven’t done much with object creation. @darren might be able to say more about that. I’m familiar with objects from JSON and Firebase but I don’t typically create the data structures as much as just access them.


Ok, I’ll see what I can do. Thanks again for all of your help!