Ok so, im working on a global leaderboard and there’s a error that i can’t figure out on what’s happening, the code is:
-- Services
local DataStore = game:GetService("DataStoreService")
-- Variables
local sf = script.Parent.ScrollingFrame
local Template = script.Sample
local dataStore = DataStore:GetOrderedDataStore("Clicks")
local ui = sf.UI
wait(5)
while true do
for _,v in pairs(game.Players:GetPlayers()) do
if v.UserId > 0 then
local status = v:FindFirstChild("Stats")
local Coins = status:FindFirstChild("Coins")
if status and Coins then
pcall(function()
dataStore:SetAsync(v.UserId,Coins.Value)
print("updated")
end)
end
end
end
local smallestFirst = false
local numberToShow = 15
local minValue = 1
local pages = dataStore:GetSortedAsync(smallestFirst, numberToShow)
local top = pages:GetCurrentPage()
local data = {}
print(top)
for a,b in ipairs(top) do
-- More of the code here
Ok, everything working fine but when it comes to the for loop in the “top” table it basically returns nothing, and if i print top it actually return nothing too. Already tested to see if the first for is saving the coins value and yes it’s saving, i used the debug tool to test it.