#Nil problem

1 messages · Page 1 of 1 (latest)

slow blaze
#

the clone.SizeLabel.Text = tostring(entry.Value) shows nil on the leaderboardeven though ive ordered everything correctly, no tutorial nor chatgpt could help me fix this, any help is appreciated

local playerSize = dataStoreService:GetOrderedDataStore("PlayerSize")

local playerInfo = script:WaitForChild("PlayerInfo")
local playerContainer = script.Parent.SurfaceGui.LeaderboardHolder

game.Players.PlayerRemoving:Connect(function(plr)
    local leaderstats = plr:FindFirstChild("leaderstats")
    if not leaderstats then return end

    local size = leaderstats:FindFirstChild("Size")
    if not size then return end

    pcall(function()
        playerSize:SetAsync(plr.UserId, size.Value)
    end)
end)

while true do
    task.wait(10)

    local success, pages = pcall(function()
        return playerSize:GetSortedAsync(false, 100)
    end)

    if not success then continue end

    for rank, entry in ipairs(pages:GetCurrentPage()) do
        local clone = playerInfo:Clone()

        local ok, username = pcall(function()
            return game.Players:GetNameFromUserIdAsync(entry.key)
        end)

        clone.UsernameLabel.Text = ok and username or "Unknown"
        clone.SizeLabel.Text = tostring(entry.Value)
        clone.RankLabel.Text = "#" .. rank

        clone.Parent = playerContainer
    end
end
crystal wind
slow blaze
#

i know what nil means, im pretty confident about localizating everything correctly aswell. ive tried everything possibly known to me and i still cant get it to work

#

yeah fuck you tostring(entry.Value) had to be lowercase