Hi, I'm trying to update statistics in cloud script based on the result of the game. Im passing the game results into cloud script as an object parameter then I can update the stats based on these values. My problem is saving these value into an array or object that the UpdatePlayerStatistics can understand. For a basic example, if they won the match then I do
var statsRequest = { PlayFabId: currentPlayerId }; var statsResult = server.GetPlayerStatistics(statsRequest); var winsKVP = statsResult.Statistics[0]; var xpKVP = statsResult.Statistics[1]; addingStats = {}; addingStats[xpKVP.Key] = 200; addingStats[winsKVP.Key] = 1; var updateStatistics = server.UpdatePlayerStatistics({ PlayFabId: currentPlayerId, Statistics: addingStats }); //The issue I'm getting is invalid input parameters so I just need a better way to be able to save these dynamic values and send the stat request with appropriate values.
//I tried searched for a better way but had no luck.