Global leaderboards using strings

Hi, a lot of players from one of my games recommended that I build a leaderboard. The only issues are that I have:

  1. never made a global leaderboard before and
  2. use strings to save the currency data as it often exceeds the limits of int and number values (I have a custom in-house module script that handles all of the adding, subtracting, etc.)

My question is: Is there a way to make a global stat leaderboard while using the strings? I’ve considered saving the lengths of the strings, but then what if someone has 100 octillion, but someone else has 999 octillion?

Thanks for reading - Spelunky

Hypothetically you could now since DataStores have key listing functions but it’s not ideal since said listing functions do not include the value. One way or another you’ll see yourself back at OrderedDataStores or not having permanent leaderboards.

If you need to save a value of over 9.223Q, check out this trick:

1 Like

This is a clever idea, though in the end, I’ve decided to use a normal data store with a single key that holds a table of tables containing the UserId and currencyamount, I’m going to keep it maxed out at 10 “entries”, It looks something like this (example):

local data = {
{UserId = 01, CurrencyAmount = "1010101010101010"},
{UserId = 02, CurrencyAmount = "101010101010101"},
{UserId = 03, CurrencyAmount = "10101010101010"},
{UserId = 04, CurrencyAmount = "1010101010101"},
{UserId = 05, CurrencyAmount = "101010101010"},
{UserId = 06, CurrencyAmount = "10101010101"},
{UserId = 07, CurrencyAmount = "1010101010"},
{UserId = 08, CurrencyAmount = "101010101"},
{UserId = 09, CurrencyAmount = "10101010"},
{UserId = 10, CurrencyAmount = "1010101"}
}

even if I increase it to 25, 50, or 100 entries, I shouldn’t run into any limitations.

Thanks for the help - Spelunky