How to get list of top players, if in OrderedDataStore saved value is table?

Hope on your help with this moment, guys!!

I don’t think you can store tables in OrderedDatastores
if you want to do something like save for a player {nickname, money, exp, reputation}, and want to sort by money, exp, and/or reputation, I’d design it so you store nickname and whatever else doesnt need to be ordered in a global datastore with the key being the player id, then store whatever needs to be ordered into DIFFERENT ordered datastores with the same key in the datastore

then when requesting all of the players’ data while sorted, pick an ordered datastore to select N players, then use those N player ids to request from the other datastores

e.g.: getting nicknames of the top 5 players by exp

get the top 5 id and exp pairs from the ordered datastore for exp, DatastoreService:GetOrderedDatastore("Exp")

get the nicknames of each of those 5 from their global datastores, DatastoreService:GetDatastore("Nicknames")

pair them up because you have {id, exp} and {id, nickname}

It’s so not optimizated!!!

then you should optimize it instead of doing it that way

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