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

Using Ordered Data Store To Make A Top 10 Leaderboard Is Not Working?

Asked by 6 years ago
Edited 6 years ago

For Some Reason This Is Not Working And It Doesn't Print Any Errors?

local DataStoreService = game:GetService("DataStoreService")
local LevelODS = DataStoreService:GetOrderedDataStore("Level")
local RS = game:GetService("ReplicatedStorage")

function SetTopLevels()
    local isAscending = false
    local pageSize = 10
    local pages = LevelODS:GetSortedAsync(isAscending, pageSize)
    local topTen = pages:GetCurrentPage()

    for i,data in ipairs(topTen) do
        local username = data.key
        local Frame = RS:WaitForChild("HighestFrame")
        Frame.PlayerName.Text = username
        local Amnt = data.Level
        Frame.Amount.Text = Amnt
        Frame.Name = i
        if i == 10 then
            Frame.Name = "99"
        end
        local ClonedFrame = Frame:Clone()
        ClonedFrame.Parent = workspace:WaitForChild("HighestLevel"):WaitForChild("Board").SurfaceGui.List
    end
end

wait(1)
SetTopLevels()

My Place Link: www.roblox.com/games/1758061261/Machinorys-Place-Number-52

Answer this question