# Leaderboards

#### Leaderboards Type

Type of leaderboards on the current platform.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FPhJvVJZw0sKQshVF9COf%2FScreenshot%202025-06-26%20at%2011.11.36%E2%80%AFAM.png?alt=media&#x26;token=4b8c0b58-8379-436b-926d-7fda479a24e3" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="176.140625">Type</th><th>Game Logic</th></tr></thead><tbody><tr><td><code>not_available</code></td><td>Leaderboards are not available. Any leaderboard functionality must be disabled in the game.</td></tr><tr><td><code>in_game</code></td><td><p>Leaderboards are available. </p><p>The game must use the <code>setScore</code> method to set the player's score.</p><p>The game should display custom in-game leaderboards using the data from the <code>getEntries</code> method.</p></td></tr><tr><td><code>native</code></td><td><p>Leaderboards are available. </p><p>The game must use the <code>setScore</code> method to set the player's score.</p><p>The game should not display custom in-game leaderboards because leaderboards are displayed in the platform interface and the <code>getEntries</code> method does not work.</p></td></tr><tr><td><code>native_popup</code></td><td><p>Leaderboards are available. </p><p>The game must use the <code>setScore</code> method to set the player's score.</p><p>The game should call <code>showNativePopup</code> to display leaderboards overlay and the <code>getEntries</code> method does not work.</p></td></tr></tbody></table>

#### Setup

Setup leaderboards in the [config file](https://wiki.playgama.com/playgama/sdk/playgama-bridge-config). For each leaderboard add an `id`. You can override which id is sent to the platform's native SDK.

```json
{
    ...    
    "leaderboards": [
        {
            "id": "test_leaderboard", // use this id in game logic
            "<ANY_PLATFORM_ID_HERE>": "<OVERRIDED_ID_FOR_PLATFORM_HERE>"
        }
    ]
}
```

#### Set Score

Submit the player's score to the leaderboard to update their rank and position.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FJjtfknUf8MWgvt5MqFMy%2FScreenshot%202025-06-26%20at%2011.13.12%E2%80%AFAM.png?alt=media&#x26;token=277fd432-b28e-4388-8175-90e1c282cc05" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PlaygamaBridge::LeaderboardsSetScore"},"parameters":["","\"YOUR_LEADERBOARD_ID_HERE\"","42",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnLeaderboardsSetScoreCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"success\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>

#### Get Entries

{% hint style="info" %}
Works only when `LeaderboardsType` = `in_game`
{% endhint %}

Retrieve entries from the leaderboard, including the player's rank and score, to display a custom leaderboard in the game.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FwWNtwHyuZbPMDvUzFxwb%2FScreenshot%202025-06-26%20at%2011.15.39%E2%80%AFAM.png?alt=media&#x26;token=4a7d7103-f11b-4df1-908c-11aa377bf7ad" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PlaygamaBridge::LeaderboardsGetEntries"},"parameters":["","\"YOUR_LEADERBOARD_ID\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnLeaderboardsGetEntriesCompleted"},"parameters":["",""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["loopindex","=","0"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"success\"","\"info\"",""]}],"events":[{"type":"BuiltinCommonInstructions::Repeat","repeatExpression":"PlaygamaBridge::LeaderboardEntriesCount()","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"ID: \" + PlaygamaBridge::LeaderboardEntryId(loopindex)","\"info\"",""]},{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Name: \" + PlaygamaBridge::LeaderboardEntryName(loopindex)","\"info\"",""]},{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Photo: \" + PlaygamaBridge::LeaderboardEntryPhoto(loopindex)","\"info\"",""]},{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Rank: \" + PlaygamaBridge::LeaderboardEntryRank(loopindex)","\"info\"",""]},{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Score: \" + PlaygamaBridge::LeaderboardEntryScore(loopindex)","\"info\"",""]},{"type":{"value":"SetNumberVariable"},"parameters":["loopindex","+","1"]}]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>

#### Show Native Popup

{% hint style="info" %}
Works only when `LeaderboardsType` = `native_popup`
{% endhint %}

Displays the leaderboard overlay, including the player's rank and score.&#x20;

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FZ4zngg9MQCLhiGHj8PCi%2FScreenshot%202025-08-29%20at%2013.16.50.png?alt=media&#x26;token=7187059e-1b01-4dd6-82a8-70349425e405" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PlaygamaBridge::LeaderboardsShowNativePopup"},"parameters":["","\"YOUR_LEADERBOARD_ID_HERE\"","42"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnLeaderboardsShowNativePopupCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"success\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
