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

Any reasons why my leaderboard code won't work?

Asked by 4 years ago
local complete,err = pcall(function()
    local Data = GlobalData:GetSortedAsync(false, 7)
    local Page = Data:GetCurrentPage()
    for Rank, PlrData in ipairs(Page) do
        local UserId = PlrData.key
        local Coins = PlrData.value
        local New = Clone:Clone()
        New.Coins.Text = Coins
        New.Name.Text = Players:GetPlayerByUserId(UserId).Name
        New.LayoutOrder = Rank
        New.Parent = Board.SurfaceGui.Background
    end
end)

An error has always been in the output that has the following error title:

ServerScriptService.Leaderboard:24: attempt to index field 'Name' (a string value)

0
Im not really sure try using a while loop when changing the value of the coins. LuaScriptingBlox 0 — 4y
0
I'm already doing that in another part of the script x_Marino -2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

I just noticed myself, that I confused the script by thinking that I am trying to rename the TextLabel.

Thank you for everyone who replied though.

Ad

Answer this question