I'm using a site called play canvas to make a game and they support playfab but I don't know how to make a leaderboard with it.
I'm using a site called play canvas to make a game and they support playfab but I don't know how to make a leaderboard with it.
You could call API UpdatePlayerStatistics in your game and PlayFab will create Leaderboard based on the statistics you upload. Please note that PlayFab doesn’t allow client to post player statistics, you need to navigate to [GameManager]->[TitleSettings]->[API Features] and enable [Allow client to post player statistics]. Because in the common scenario, permitting clients to post statistics will cause abusive use as it changes the ranks for each player.
The code should be something like this.
function UpdatePlayerStatistics(){ PlayFab.settings.titleId = "xxx"; var request = { Statistics: [ { StatisticName: "xx", Value: 10 } ] }; PlayFabClientSDK.UpdatePlayerStatistics(request, Callback); } var Callback = function (result, error){ // context }
could you dumb it down a little please im kind of new to this stuff.
where would i use this and how would i configure it.
also how would i display the leaderboard
>>where would i use this and how would i configure it.
First, you need to import PlayFab JavaScript SDK into your project. Then you can implement the code in a script. Please follow the official document - https://docs.microsoft.com/en-us/gaming/playfab/personas/developer to learn more about how to work with PlayFab.
>>also how would i display the leaderboard
After you update a player’s statistics, you can call API GetLeaderboard to get the corresponding leaderboard.
Please feel free to let me know if you have any other questions.
2 People are following this question.