> For the complete documentation index, see [llms.txt](https://daddy-studios.gitbook.io/daddy-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-loading/leaderboards.md).

# Leaderboards

The Leaderboard and Top Crew panels show data that your scripts provide. There is no database integration. The data lives in the server memory and is empty after a restart until your scripts send it again.

Everything below runs on the server. The screen shows at most three entries.

## Push data from another resource

```lua
exports['daddy-loading']:SetTopPlayers({
    { name = 'Player One', kills = 42, deaths = 10, avatarUrl = 'https://example.com/avatar.png' },
    { name = 'Player Two', kd = '30K / 12D', score = '2.50' },
})

exports['daddy-loading']:SetTopCrews({
    { name = 'Crew One', totalKills = 320, totalDeaths = 110, image = 'https://example.com/crew.png' },
})
```

Update both lists in one call:

```lua
exports['daddy-loading']:SetLeaderboardData({
    topPlayers = players,
    topCrews = crews,
})
```

Server events do the same:

```lua
TriggerEvent('daddy-loading:server:setTopPlayers', players)
TriggerEvent('daddy-loading:server:setTopCrews', crews)
TriggerEvent('daddy-loading:server:setLeaderboardData', { topPlayers = players, topCrews = crews })
```

## Pull data from another resource

Set the provider exports in `config.lua`:

```lua
Config.Leaderboard = {
    RefreshInterval = 60 * 1000,
    Providers = {
        TopPlayers = { Resource = 'my-pvp', Export = 'GetTopPlayers' },
        TopCrews = { Resource = 'my-crews', Export = 'GetTopCrews' },
    },
}
```

Each provider export must return an array with the same fields as above. Providers are read when they start and on every refresh interval.

## Utility exports

```lua
local players = exports['daddy-loading']:GetTopPlayers()
local crews = exports['daddy-loading']:GetTopCrews()

exports['daddy-loading']:RefreshLeaderboardData()
exports['daddy-loading']:ClearLeaderboardData('players')
exports['daddy-loading']:ClearLeaderboardData('crews')
exports['daddy-loading']:ClearLeaderboardData()
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-loading/leaderboards.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
