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

Global Leaderboard Rank Icon glitches, how to fix?

Asked by 3 years ago

I made a global leaderboard that duplicates ranks from players onto the surface rank of a block. Only the last place in the leaderboard has his/her #..rank the others have a white blank frame. Script below:

local ds = game:GetService("DataStoreService")

local coinsODS = ds:GetOrderedDataStore("CoinsStats")


local timeUntilReset = 10


while wait(1) do


    timeUntilReset = timeUntilReset - 1

    script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."


    if timeUntilReset == 0 then

        timeUntilReset = 10


        for i, plr in pairs(game.Players:GetPlayers()) do

            coinsODS:SetAsync(plr.UserId, plr.leaderstats.Coins.Value)
        end

        for i, leaderboardRank in pairs(script.Parent:GetChildren()) do

            if leaderboardRank.ClassName == "Frame" then
                leaderboardRank:Destroy()
            end
        end


        local success, errorMsg = pcall(function()

            local data = coinsODS:GetSortedAsync(false, 5)
            local coinsPage = data:GetCurrentPage()

            for Rank, dataStored in ipairs(coinsPage) do


                local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
                local coins = dataStored.value


                local template = script.Template:Clone()

                template.Name = name .. "Leaderboard"

                template.PlrName.Text = name

                template.Rank.Text = "#"..Rank

                template.Coins.Text = coins

                template.Parent = script.Parent             
            end         
        end)
    end
end

0
Just try to mkae like a certain area that your having issues with. There is no way someones gona read all that. BMWLux 0 — 3y

Answer this question