question

shootertutorial@gmail.com avatar image
shootertutorial@gmail.com asked

Problem with UpdateUserStatistics

I have simple function in cloud:

var levelname = args.level;

var score = args.score;

server.UpdateUserStatistics({

PlayFabId: currentPlayerId,

UserStatistics: { levelname: score } });

Why levelname isn't taken as args.level string? 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

In other words, the problem is that the Key is always "levelname" in this example, right? Here's a post that provides details on this, and the solution: https://community.playfab.com/hc/en-us/community/posts/205460148-Cloud-Script-how-do-I-write-data-to-a-Key-which-is-defined-dynamically

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shootertutorial@gmail.com avatar image
shootertutorial@gmail.com answered

Basically I would like to have one function to update each level score - I will have multiple levels and passing level name as argument would be nice. 

Level scores will be stored in player statistics. 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.