I dont know how to create a leaderboard

I don’t know how to create any runtime function. I wanna create a leaderboard and I made its .ts file and copy it in modules folder. but I don’t know how to run at start up. In documenting there is no complete explanation.

Hey @ghasem167 have you taken a look at our Typescript runtime setup guide? I recommend taking a look at that guide for how to setup your tsconfig.json, Docker, and NPM for your runtime code.

As for creating a basic leaderboard yourself, you’ll want to invoke nk.leaderboardCreate(...) in your runtime code. For example:

let id = '4ec4f126-3f9d-11e7-84ef-b7c182b36521';
let authoritative = false;
let sort = nkruntime.SortOrder.DESCENDING;
let operator = nkruntime.Operator.BEST;
let reset = '0 0 * * 1';

let metadata = {
  weatherConditions: 'rain',

try {
    nk.leaderboardCreate(id, authoritative, sort, operator, reset, metadata);
} catch(error) {
    // Handle error
1 Like

I watched it and do anything but I have this problem

@ghasem167 there’s a reply in that thread to your issue.