Справочник функций
Godot 4 · GDScript · Leaderboards & scores
get_best_score
Returns the player's cached best score on a table (0 if unknown).
Synchronous (returns directly)
Signature
get_best_score(table_index: int) -> intWhat it does
Reads the locally cached best score for that table (filled on table load and after a successful submit). No network call, so it works offline.
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 display the player's best instantly.
Returns: int: the cached best score, or 0 if the index is invalid or no score is known yet.
Example
print("your best: %d" % Gamdato.get_best_score(1))Use cases
- Show the player's personal best in the HUD or results screen.
- Compare against a new run to decide whether to celebrate a new record.