I know Data Stores themselves, Can anyone explain how 'ordered' data stores work though? I'm not asking for a script, just an explanation.
"OrderedDataStore is a type of DataStore where the value must be an integer (positive number). This is done in order to create a way to easily order key/value pairs, making it suitable for leaderboard related scripting where you are required to order large amounts of data efficiently. For example, you can write a script that shows the top 100 high scores in your game. "
OrderedDataStore work much like DataStore. The only different is that OrderDataStore return a table of, well a DataStore but in a order. For Example, 'highscores'
1 | local OrderDataStore = Game:GetService( 'DataStoreService' ):GetOrderedDataStore( 'HighScore' ) |
2 | local Pages = OrderDataStore:GetSortedAsync( false , 5 ) |
3 | local Data = Pages:GetCurrentPage() |
4 | for Key, Value in pairs (Data) do |
5 | print (Key .. ": " .. Value ) |
6 | end |
That would print out the greatest amount of points to the lease.
OrderDataStore order the data by integers.
Accept and upvote :)