Hello!
I am making an admin panel for updating and removing people from an ordered data store leaderboard.
In the update and remove functions (Server-Sided) when I use RemoveAsync
or UpdateAsync
the datastore never updates to the new values. Unless I run the function over 500+ times, it worked once
I have looked around the devforum and found no topic pinpointing this problem.
Lè functions
-- retry(retries: number, callback: (...) -> any, ...): (any?, boolean)
-- retries running the callback *x* amount of times if an error is thrown.
-- *isWhitelisted* is just a utility function, don't mind it
function RemoveUserData(player, leaderBoard, targetPlayerId)
if not isWhitelisted(player.UserId) then return end
local _, success = retry(4, function(ds: OrderedDataStore)
return ds:RemoveAsync(targetPlayerId)
end, DataStore)
if not success then
print("WARN: There was an error removing user data.")
end
end
function UpdateUserData(player, leaderBoard, targetPlayerId, newTime)
if not isWhitelisted(player.UserId) then return end
local _, success = retry(4, function(ds: OrderedDataStore)
return ds:UpdateAsync(targetPlayerId, function()
return tonumber(("%0.0f"):format(newTime * 1000))
end)
end, DataStore)
if not success then
print("WARN: There was an error trying to update a user.")
end
end
Thanks!
- SkyLord_103