I want to make a top players leaderboard gui script, but this only works with ordered data store, my game is using normal data stores and I dont want to change to ordered data store because I am not sure if it will reset all stats.
Stat = "Robux"
local DataStore = game:GetService("DataStoreService"):GetDataStore("#####")
function updateBoard(board, data)
for k,v in pairs(data) do
local pos = k
local name = v.key
local score = v.value
local nametextbox = script.Parent.Background.Top:FindFirstChild("Name" .. pos)
nametextbox.Text = name
local scoretextbox = script.Parent.Background.Top:FindFirstChild("Score" .. pos)
scoretextbox.Text = score
end
end
while true do
local pages = DataStore:GetSortedAsync(false, 10)
local data = pages:GetCurrentPage()
updateBoard(script.Parent.Background.Top, data)
if not pages.IsFinished then
pages:AdvanceToNextPageAsync()
data = pages:GetCurrentPage()
end
wait(30)
end
