Unable to get table.sort() to function as I would like

In short, I’m trying to order a table from greatest to least for a global leaderboard mechanic, but with my given table, it won’t sort correctly.

Code snippet:
problem

It returns a slur of un-ordered number’s and I’m not exactly sure why…

What it returns:
image

The table is retrieved from an Ordered Data Store, and v.score/vv.score is just the player’s recorded scores. {key = UserId, score = 50}

Some help would be appreciated!

Can you show more of your code? You should show the entire process of retrieving the code from the datastore to printing it.

Doesn’t GetSortedAsync already sort the table as required? Considering you’re fetching the array from an OrderedDataStore, you’d think that it’s not necessary to implement table.sort. Does a print-iteration throughout the results of the call not show up in order? Is there something else that you’re overlooking?

1 Like

Yeah… that’s totally my fault.
image

Added this extra step completely forgetting about that.