Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix OrderedDataStore not showing contents?

Asked by
aredanks 117
4 years ago

I am trying to create a table of values in an ordered data store but does not create a table of values but leaves the table empty as when it does GetSortedAsync() and then GetCurrentPage() on it, there is just nothing.

Here is the script but note that I do not include the datastore variables since it is unnecessary to the question as I did not write them wrong (OrderedDataStore is exactly what it says),

local isAscending = false
local pageSize = 5
local pages = OrderedDataStore:GetSortedAsync(isAscending, pageSize)
local topFive = pages:GetCurrentPage()
local orderedTable = {}
print(#topFive) -- returns 0 but table exists
for rank, data in ipairs(topFive) do -- doesn't run since topFive is an empty table
    orderedTable[data.Key] = data.Value
end

There are also no errors and I have already checked for values within the datastore which does exist and are saved into it.

Answer this question