It worked for lower numbers like numbers in Quintillion(Qn) and below, but it stopped updating the value after it got so high. I've tried for the past 20 mins to fix it and I can't think of any more ways to try.
local Stat = "Money"
local PlayerCount = 30
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Leaderboard_"..Stat)
local Pages = DataStore:GetSortedAsync(false,PlayerCount)
local Data = Pages:GetCurrentPage()
game.Players.PlayerRemoving:Connect(function(Player)
if Player:FindFirstChild("Stats") then
DataStore:UpdateAsync(Player.UserId, function(oldValue)
return Player.Stats[Stat].Value
end)
end
end)

2 comments
Are you sure that the value isn't being updated? Are you simply looking at the OrderedDataStore for that? Does the script ever reach the :UpdateAsync line?
yea it reaches the line, I had a print statement in the function and it would print, it would just never update the value