Hey everyone, I'm trying to create a data object in TypeScript using variable information. My code for this is:
handlers.VerifyComponent = function (args) { var activePreset = args.currentPreset; var componentName = args.componentName; var componentType = args.componentType; var userInventory = server.GetUserInventory({ PlayFabId: currentPlayerId, }); for (var i = 0; i < userInventory.Inventory.length; i++) { if (userInventory.Inventory[i].ItemId == componentName) { var characters = server.GetAllUsersCharacters({ PlayFabId: currentPlayerId }); for (var i = 0; i < characters.Characters.length; i++) { if (characters.Characters[i].CharacterName == activePreset) { var character = characters.Characters[i]; server.UpdateCharacterReadOnlyData({ PlayFabId: currentPlayerId, CharacterId: character.CharacterId, Data: { componentType: componentName } }); } } return true; } } return false; };
This however doesn't work, and I don't know how to check CloudScript errors. It I replace the data to something like "Hat":"WizardHat" it works fine. Not sure if it has to do with how variable data is handled. Any help would be great, thanks!