Why leaderboard refresh buttons can break data loading
Each player adds only two ordered list requests a minute to a server's budget. How to serve top lists and lookups from a server copy.
What it looks like
A remote reads a data store each time a player asks: a "refresh leaderboard" button, a page of a global top list, another player's stats or plot, a search through saved keys. The handler often has a per-player cooldown, but the cooldown is shorter than the share of the request budget each player brings, so the players in a server can ask for more requests than Roblox allows.
remote.OnServerInvoke = function(player) if os.clock() - (lastRefresh[player] or 0) < 5 then return nil end lastRefresh[player] = os.clock() return topCoins:GetSortedAsync(false, 10):GetCurrentPage() end
What an exploiter could do
When a server goes over budget, Roblox puts further requests in a queue, and each queue holds 30 requests before the rest fail and are dropped. Standard reads share one queue, so lookups fired by one exploiter, or by ordinary players clicking refresh, delay and then drop the reads that load joining players' data. Players can join to an empty profile or be kicked by the game's load-failure handling, and leaderboards and other lookups stop working for the whole server.
How to fix it
- Read shared data on a server schedule and keep a copy. Refresh a top list once a minute or less and answer every player from the copy.
- For another player who is in the same server, answer from their loaded profile instead of the data store.
- Cache lookups of other keys on the server for a while, and give the remote a per-player cooldown long enough that the server's players together stay well under the budget.
- Check
DataStoreService:GetRequestBudgetForRequestTypebefore optional lookups and skip them when the budget is low, so saves and loads keep the requests they need.
Vulnerable example
local DataStoreService = game:GetService("DataStoreService") local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local topCoins = DataStoreService:GetOrderedDataStore("TopCoins") local cooldown = 5 local lastRefresh: { [Player]: number } = {} ReplicatedStorage.Remotes.GetTopCoins.OnServerInvoke = function(player: Player) local now = os.clock() if now - (lastRefresh[player] or -math.huge) < cooldown then return nil end lastRefresh[player] = now local ok, pages = pcall(topCoins.GetSortedAsync, topCoins, false, 10) if not ok then return nil end return pages:GetCurrentPage() end Players.PlayerRemoving:Connect(function(player) lastRefresh[player] = nil end)
Fixed example
local DataStoreService = game:GetService("DataStoreService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local topCoins = DataStoreService:GetOrderedDataStore("TopCoins") local refreshEvery = 120 local top: { { key: string, value: number } } = {} ReplicatedStorage.Remotes.GetTopCoins.OnServerInvoke = function() return top end while true do local ok, pages = pcall(topCoins.GetSortedAsync, topCoins, false, 10) if ok then top = pages:GetCurrentPage() end task.wait(refreshEvery) end
How to spot this in your own scripts, and the cases that only look like it, are part of the Luaudit check your AI runs.