Reference des fonctions
Godot 4 · GDScript · Leaderboards & scores
get_player_pos
Returns the player's cached global rank on a table (0 if unknown).
Synchronous (returns directly)
Signature
get_player_pos(table_index: int) -> intWhat it does
Reads the locally cached global position for that table (filled on table load and after a successful submit). No network call.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| table_index | int | required | Table number to read (1-based: 1, 2, 3…). |
How to call it
Call any time after tables_loaded to show the player's rank instantly.
Returns: int: the cached global rank, or 0 if the index is invalid or the rank isn't known yet.
Example
print("your rank: #%d" % Gamdato.get_player_pos(1))Use cases
- Display the player's worldwide rank next to their score.
- Show progress toward the top of the leaderboard.