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

[Datastore][Edited] Why does this not output??

Asked by 9 years ago

I have ban's in the storage but I get no output from it, why would this not work?

I have checked the wiki several times to make sure it would work and even though it looked correct; I get no output, nothing.

local CDS = game:GetService("DataStoreService"):GetOrderedDataStore(Gravity_V4._DATASTORESync.BanlistLink)
local CPage = 1
local Page = CDS:GetSortedAsync(false, 5)
for k,v in pairs(Page:GetCurrentPage()) do

    print(k,v)  -- I get no print or output.

end)
1
Any comments or anything like that will be highly helpful! MessorAdmin 598 — 9y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

This problem is very subtle, but it looks to me that Ordered Datastores are 0-indexed, not 1-indexed. What this means is that the first page is page '0', not page '1'.

To fix this, change line 2 to local CPage = 0.

Ad

Answer this question