#Trying to reset player points for a leaderboard

1 messages · Page 1 of 1 (latest)

hearty otter
#

Profile Store

#
function Leaderboard.ResetAllRecyclePoints()
    print("Starting recyclePoints wipe for all users...")

    local userKeys = {}
    local success, pages = pcall(function()
        return RecyclePointsOrdered:GetSortedAsync(true, 100) -- Ascending
    end)

    if success and pages then
        for _, entry in ipairs(pages:GetCurrentPage()) do
            table.insert(userKeys, entry.key)
        end
    else
        warn("Failed to fetch keys from OrderedDataStore")
        return
    end

    for _, userId in ipairs(userKeys) do
        print(PlayerStore)
        local profile = ProfileStore:LoadAsync("User_" .. tostring(userId), "ForceLoad")
        if profile then
            profile.Data.recyclePoints = 0
            profile:Save()
            profile:Release()
            print("reset points " .. userId)
        else
            warn("failed to load profile " .. userId)
        end

    end


    print("finished resetting recyclePoints for all profiles.")
    return nil
end
#

i dont believe "LoadAsync" exists but im struggeling to find the alternative in the docs

#

i need to reset offline player's data but specifically only their recyclePoints

hearty otter
tropic maple
hearty otter
#

i understand but i think for my time limit that would take a couple of hours

#

i imagine they have some built in method but its quite hard to find