MemoryStore SortedMap SortKey [Full Release]

Hi Developers,

Thank you for all of your feedback regarding our beta launch. We are excited to announce that the Sorted Map Data Structure in the MemoryStore Service, which supports sorting the items with a special sort key field, is now available to everyone. This feature is fully backward compatible and will not disrupt your existing usage of MemoryStore Sorted Maps.

We understand that for certain use cases, such as leaderboards, you would like to have the ability to sort items in your Sorted Map by something other than the key. With this new sort key field, the data in your Sorted Map will be sorted using this optionally supplied sort key. Some details on this parameter:

  • The sort key can be up to 128 bytes in size
  • It can be a string or a number (integer or floating point)

Items with a sort key will sort before items without a sort key. Numeric sort keys will take precedence over items with string sort keys.

Happy building!

The Roblox Creator Services Team


This topic was automatically opened after 10 minutes.

The fact that it is backwards compatible is great!


Hi, this is awesome! What’s the chance we can query a keys position in the sorted map? Use case is leaderboards, of course, but a lot of people are running expensive external infrastructure to get this number.

I only care about accuracy for the top 1,000 or so. After that my tolerance for ± increases a lot.


Hi there, currently there is no API to support this. We are evaluating this request internally, I will update you once we have more details to share :slight_smile:


This will be very helpful with the matchmaking system I made using MemoryStores, thank you!!!


Definitely echo the value of querying a key’s position in a sorted map. Would avoid having to load up a datastore at frequent intervals and iterate thru every value to calculate the positions


Wait the datastore solution works? I was sure that it wouldn’t scale with player count so we’ve never tried that.


Considering you can only get 100 ordered keys per page, and a scalable solution must support millions of users; this isn’t possible. Even if you don’t use an OrderedDataStore, it’s too many entries to save, load, and sort.


Yea this approach is terrible if you want accuracy on your ranking system. We basically have a system that is only precise for the top 200 scores. Everyone else will get a ranking of 200+, 1000+ or 5000+ based on the server saved values for each ranking. We batch save these scores and update the leaderboard at a set interval to conserve requests. If someone scores top 200 tho - the datastore is immediately updated


Glad to see this is finally fully released! Looking forward to seeing how people use this in new projects

1 Like