Studio GuideWorld SDK Guide
Log In

Recording Score

LeaderboardAPI.SetScore() is an API that records the user's score on the leaderboard.
Leaderboard ID, Score value, the point of completion and the point of error are passed as an argument.

User information for the score will automatically be saed.

The following is an example for loading the LeaderboardAPI.SetScore function.

LeaderboardAPI.SetScore(this.leaderBoardId, this.score, this.OnResult, this.OnError);

The following is the code template for retrieving the user's score to the leaderboard.

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { SetScoreResponse, LeaderboardAPI } from 'ZEPETO.Script.Leaderboard';

export default class SetScoreExample extends ZepetoScriptBehaviour {

    public leaderboardId: string;
    public score: number;

    Start() {
        LeaderboardAPI.SetScore(this.leaderboardId, this.score, this.OnResult, this.OnError);

    OnResult(result: SetScoreResponse) {
        console.log(`result.isSuccess: ${result.isSuccess}`);

    OnError(error: string) {

LeaderboardAPI.SetScore Run Screen