Ah, that’s the wrong place. Since you’re going to destroy it, the score value will vanish.
Save it in the PlayerState BP. Create one like this:
Then add it to your current GameMode as the default PlayerState class:
Inside of the PlayerState Blueprint, create your Score variable. There is already one from Epic, so name it a bit different!
Now, inside of your Actor you want to destroy, do this:
And since you already know how to bind a value to your Widget Text, do this for the binding:
Normally you should make sure that every exec (so also the cast fail and IsNotValid one) reach the ReturnNode. Otherwise you could
get crashs. I do this by adding a Local Variable for the return value and set it to a empty or a default value if the casts etc fail and
otherwise to the value i wanted to return (the score at this point).