RegisterPlayerDataProvider
Extend FS-Scoreboard player data from another server resource
RegisterPlayerDataProvider
Registers a callback that can add badges, metadata, search terms, or selected role/status overrides without modifying FS-Scoreboard.
local registered, providerKey = exports["FS-Scoreboard"]:RegisterPlayerDataProvider(
"staff-status",
function(playerId, player)
if not IsPlayerAceAllowed(playerId, "scoreboard.staff") then
return nil
end
return {
badges = {
{ label = "Staff", color = "violet" }
},
metadata = {
{ label = "Team", value = "Community" }
},
searchTerms = { "staff", "moderator" }
}
end,
100
)The callback receives the numeric player server ID and the current player entry. It runs once per player whenever the roster refreshes, so it should remain fast and must not yield.
The optional priority defaults to 100. Lower numbers run first. When providers
override the same field, the provider that runs last wins.
Provider result
A callback can return any combination of:
badges: up to eight{ label, color }entriesmetadataorfields: up to six{ label, value }entriessearchTerms: up to ten additional search stringsjob,department,category,service, orcivilianServiceavailable,unitStatus,statusCode, orstatusLabelcallsign
Provider errors are isolated and logged once until the provider succeeds again.
Return values
The export returns true, providerKey on success or false, errorMessage when the
name or callback is invalid. Provider names are namespaced to the calling resource.
UnregisterPlayerDataProvider
local removed = exports["FS-Scoreboard"]:UnregisterPlayerDataProvider("staff-status")Returns true when the provider was removed. Providers are also removed automatically
when their owning resource stops.