it saves to the leaderboard UI the correct values but yes it fires the print string on the Is Not Valid execution so i can it fails every time because it doesn’t destroy the object like it does if it was valid
We can’t see that here - how do you update it? All the print string is saying here is that the Save Game data object does not exist. When do you create it?
When you say “it saves” here, what do you mean? Is there another saving system or you simply mean an UI widget update?
What does the save game being invalid has to do with the UI update? Again, where do you update the UI? You say they are somehow connected, but we can’t see it here.
Is this script in the Game Mode? Does it trigger? Because to me it looks like you do it in the Level Bluerpint… not in the Game Mode. So the the GM’s PlayerSaveGame var is simply invalid.
sorry it appears it is broken, which in a way i guess is good
this is the coin pickup, it accesses the player save reference and checks its L1Coin value saved to it and if it’s bigger than the current coin variable amount in the player character
the logic is that the coin compares the characters current coin value they collected to the saved variable in the game save if the local is higher it saves it to the player save, replacing it with the higher score which gets represented (or is suppose to) on the leaderboard widget
I would. LB is good for stuff that is unique to this level only. If you have 1 level only in the entire game where there are coins to collect - you can use the LB for this. Other than that, avoid it.
If you’re going to have LVL_2, or worse, lvl_3! would you like to create the very same script for EVERY level?
What you have does not belong to the LVL BP unless there is only 1 level in the entire game. And even then, I still would not do it. It also seems that we duplicate a lot of variables. This is not really necessary. Have a look at my example - the Game Mode does it all. And you can take it further, too:
Looks fine-ish… I just would not burden EVERY coin in the game with script - do the coins really need to know what the player is doing, what the save game is doing, what the game mode is doing? Why repeat the same script in 100s of actors… The coin’s job is to be collected, play sound, and get destroyed, not to handle save game communication:
okay i’ve fixed it to the point the leaderboard and ui are representing the data correctly and all that but the leaderboard gets wiped on Open Level i think, and i only ever want it to wipe when the save game is deleted or change when a new higher number of coins is collected to replace the same game that was lower than a previous attempt
However, if you want something more advanced and proper, I’d move the whole thing to the Game Mode, perhaps even the player does not need to know about any of this:
The above translates to: whenever the player overlaps coins, we destroy the coin, increase a variable in the save game, and update the UI. The simpler it is now, the easier it will be to update later.
There is also the Game State and the Player State but if it’s single player, I would not bother.
Load the SG with the top score, and compare it to the current SG’s values.