How would i get players with the highest level from dictionary based data

im just gonna preface this by saying:

  • i am an idiot
  • i literally just migrated to a dictionary based data system
  • if i didnt migrate data, this wouldnt have happened
  • this post probably doesnt follow guidelines, apologies if it doesnt

how exactly would i go about getting 20 players with the highest levels, with that data stored in a dictionary?

im aware that if i was still using my old (and terrible) system, i could achieve this easily with :GetOrderedDataStore since levels are just stored like this
image
but my player data is now structured like this
image

this is also gonna be used for a leaderboard so ive already ruled out the idea of just checking every single entry
if anyone can help here, that would be amazing
ive spent about an hour looking for solutions with absolutely no results

You should keep a separate list of player/profile IDs for this purpose. Then, also keep reference to the current lowest level you care about (the 20th highest in your case). Anytime someone passes this level, the list of top 20 will need updated, and also when anyone’s level changes who is currently in the top 20.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.