# Use Generic Leaderboards

### Get list of Scores

List the top 50 scores from a leaderboard.

{% tabs %}
{% tab title="Unity" %}

<pre class="language-csharp"><code class="lang-csharp"><strong>string leaderboardKey = "my_leaderboard";
</strong>int count = 50;

LootLockerSDKManager.GetScoreList(leaderboardKey, count, 0, (response) =>
{
    if (!response.success) {
        Debug.Log("Could not get score list!");
        Debug.Log(response.errorData.ToString());
        return;
    } 
    Debug.Log("Successfully got score list!");
});
</code></pre>

Check out the [Reference Documentation](https://ref.lootlocker.com/game/api-5291504) for a more in-depth understanding of the endpoint.
{% endtab %}

{% tab title="Godot" %}

<pre class="language-gdscript"><code class="lang-gdscript">
<strong>var leaderboardKey : String = "my_leaderboard";
</strong>var count : int = 50;

var response = await LL_Leaderboards.GetScoreList.new(leaderboardKey, count).send()
if(!response.success) :
    # Request failed, handle errors
    pass
else:
    # Request succeeded, use response as applicable in your game logic
    pass
</code></pre>

{% endtab %}
{% endtabs %}

### Use Generic Leaderboard as a Clan List with Members

Use a Leaderboard to store a list of members in a clan or guild.

{% tabs %}
{% tab title="Unity" %}

```csharp
string clanName = "super cool clan!";
string metadata = "{clan_members:5213125,534034,534238,213890}";
string leaderboardKey = "leaderboard_clan_list";
int clanScore = 519;

LootLockerSDKManager.SubmitScore(clanName, clanScore, leaderboardKey, metadata, (response) =>
{
    if (!response.success)
    {
        Debug.Log("Could not submit score!");
        Debug.Log(response.errorData.ToString());
        return;
    }
    Debug.Log("Successfully submitted score!\n with metadata: " + metadata);
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/acAAL86MvZi4yJVHk1oo" alt=""><figcaption></figcaption></figure>

To copy and paste the above example into your editor, [look here](https://blueprintue.com/blueprint/8xnu73ja/).

**Input**

You need to exchange the `SubmitClanScore` event for whatever event you want to use to trigger this flow.

Replace the input variables with the data you want to submit to the leaderboard.

**Output**

We recommend branching the completed events on the success flag in the response, and if you do this, you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.
{% endtab %}

{% tab title="Godot" %}

```gdscript

var clanName : String = "super cool clan!";
var metadata : String = "{clan_members:5213125,534034,534238,213890}";
var leaderboardKey : String = "leaderboard_clan_list";
var clanScore : int = 519;
var response = await LL_Leaderboards.SubmitScore.new(leaderboardKey, clanScore, clanName, metadata).send()
if(!response.success) :
    # Request failed, handle errors
    pass
else:
    # Request succeeded, use response as applicable in your game logic
    pass
```

{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/leaderboards/1/submit" \
  -H "x-session-token: your_token_here" \
  -H "Content-Type: application/json" \
  -d "{\"score\": 1000, \"metadata\": \"{members:5129312,952134,123123,5129354}\"}"
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-generic-leaderboards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
