I'm working on creating a prize table for my new leaderboard. I want to reward the player with an item that is stored in a JSON in player data (title) via cloud script. I want to get the index of that item and increase it in the script.
I was trying to accomplish this by getting the players data. Updating it at the index and then updating. However this doesn't seem to be working. Any help would be greatly appreciated!
handlers.dailyRewardPos1 = function (args, context)
{
var getPlayerInfo = server.GetUserData
({
PlayFabId: currentPlayerId,
Keys: ["PlayerData"]
});
var myObject = JSON.parse(myJsonString);
var itemToUpdate = myObject.PlayerData[22] += 1;
var Update = server.UpdateUserData
({
"PlayFabId": currentPlayerId,
"Data": itemToUpdate
});
}