Download

Save game integer not changing

Hi everyone, I’ve run into an issue and was hoping for some assistance. I have been searching the internet and trying different ways of approaching this for the past 3 hours and it’s starting to give me a headache :frowning:

I have an in-game store, where the player can spend tokens they have collected, on powerups and character customisation etc. I am trying to set up the OnClicked of an item button so that it checks if the user has enough tokens and then deducts the required amount and saves the remaining tokens. So far I have tried using the GameInstance to store the TokenData but this seems to reset on closing the game, which is no good for holding a currency. The screenshot attached is of the Blueprint I have reverted back to testing after trying the GameInstance.

Am I setting this up all wrong? I have had it set up a couple of ways with no joy…

The TokenData is originally saved within the ThirdPersonCharacter BP, Other than the way i have tried in the image shown I have also attempted to cast to the ThirdPersonCharacter and get the Save Game Object when saving to slot within my Store Widget BP.

Thanks in advance for any help at all, this is really burning me out.

Aaron

Hi Everynone, the default value is 0. I have managed to get it working now. I’m not sure if there is a simpler way of doing it, although it does seem fairly simple, it just took me a while to get there through trial and error as i’m still learning.

Here is the updated BP for anyone who may run into the same problem :slight_smile:

Please share with me your blueprint