#Trying to reset player points for a leaderboard
1 messages · Page 1 of 1 (latest)
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
I would advice to work with your own datastore systems. But https://madstudioroblox.github.io/ProfileStore/api/#startsessionasync should work
will it work on offline player's data?
No clue, you would have to either try it or reverse the module to know for sure. This is why I said that I would've just made my own datastore wrapper if I were you