How could I go about making a leaderboard based on leaderstats?

Alright, so I am looking to make a basic leaderboard for my game. Each player has a folder named leaderstats and has an IntValue named “Kills” inside of it.

I have a TextLabel in replicated storage named “Template.”

I have a part with a surface gui named “leaderboard” in workspace.

How could I make it so there are text labels that are sorted from the most kills to the least kills? I would also like to have the player’s name next to their kills if it is possible :smile:

I know that table.sort can be used in some way but I don’t really know what it does or how to use it.

I think I’ve posted this way too much times to the point where I forgot who I’ve posted this to

(If it’s confusing for you, I can try my best to explain it)

1 Like

I see that is for global leaderboards… I would prefer to just do a leaderboard for those in the server…

You could research sorting algorithms, the simplest one is bubble sort.

Oh so you’re talking about like a server based leaderboard alrighty then, here’s the thing with making leaderboards (Regardless of global or server)

I think you still need to follow the code that the global leaderboard gives you, as it does require some UpdateAsync related stuff and GetFlippingPageSomethingSortedASync to organize how the place system will work

Unless if you just want the default leaderboard, but I don’t think that’s not what you want

1 Like

Oh boy… this sounds a bit more complicated than I was expecting. I originally just figured I could have a table with everyone in the game and their kills. I could update the table about every second or so and use table.sort() to organize them from greatest to least.

basically, I want to just perfectly recreate the leaderstats gui on the playerlist on a surface gui. I’ll make sure to look through the resource you sent and see if I can find anything that can help me.

Oh, yeah I think you’d need to use some RemoteEvent configuration & tables I believe to make that happen? Unless if you want to handle it on the server

Im going to handle it on the server. I think I have it mostly figured out, I just need to figure out how to use table.sort() to organize a table based on their kills.

(I have their kills saved with their name in a dictionary.)

Gotcha, yeah table.sort I believe will work (Adding onto the GetSortedAsync & GetPageSomethingAsync as well)