question

alireza avatar image
alireza asked

Remove specific keys from Player Data for all players

Hey there,

I want to remove 2 keys from Player Data for all players.

10 |1200

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

1 Answer

·
Rick Chen avatar image
Rick Chen answered

You could use CloudScript, Segments and Schedule Task to achieve this in following steps:

  1. Write a CloudScript that removes the data from current player, for example:
handlers.RemoveData = function(args,context){
    server.UpdateUserData({
        PlayFabId: currentPlayerId,
        KeysToRemove: ["KeysToRemove","AnotherKey"]
    });
}
  1. Go to [Game Manager]->[Your Title]->[Players], choose [Segments] Tab. By default, there should be a Segment called “All Players”.
  2. Tick the All Players Segment, choose Run task, it will jump to where you create a scheduled task.
  3. Enter a Name, choose “Run actions on each player in a segment” in type of task field, choose “All Players” in Segment field.
  4. In the Action field, choose Add action, then in the Type field, choose Execute CloudScript and in the Cloud Script Function Field, choose the CloudScript you wrote in the previous step.
  5. Click “Save and run”.

Please refer to https://docs.microsoft.com/en-gb/gaming/playfab/features/automation/actions-rules/bulk-actions-for-an-entire-player-segment

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.