question

destroy091 avatar image
destroy091 asked

public permission using cloud script Revisions (Legacy)

i made the next code to make silver key as public in the player data page section but didn't work for me how can i make a key as public?

handlers.UpdatePlayerData = function (args, context) { server.UpdateUserData({ PlayFabId: currentPlayerId, Data: { "Silve": {Value: args.Silve, Permission: UserDataPermission.Public}, "Tutorial": args.Tutorial , "Boy": args.Boy , "Bio": args.Bio } }) }

CloudScript
1 comment
10 |1200

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

destroy091 avatar image destroy091 commented ·

sorry this is the code more clear handlers.UpdatePlayerData = function (args, context) { server.UpdateUserData({ PlayFabId: currentPlayerId, Data: { "Silve": {Value: args.Silve, Permission: UserDataPermission.Public}, "Tutorial": args.Tutorial , "Boy": args.Boy , "Bio": args.Bio } }) } the only part i've added to make the key as public is this "Silve": {Value: args.Silve, Permission: UserDataPermission.Public}

the key named " Silve " is still private even when i changed the value using api calls

0 Likes 0 ·

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

The Permission parameter of the PlayFab UpdateUserData API is specified for all user data in one call. In one API call, it cannot specify different permissions for different user data. Here is working code you can refer to.

 handlers.Test=function(args,context)
 {
     return server.UpdateUserData({ PlayFabId: currentPlayerId, Data: { "Silve": args.Silve},Permission: "Public" });
 }
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.