# Not Updating Variable

**URL:** <https://forums.unrealengine.com/t/not-updating-variable/362460>\
**Category:** Editor Scripting\
**Tags:** savegame, variables, unreal-engine, Blueprint, question\
**Created:** [June 29, 2016, 7:31pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460 "2016-06-29T19:31:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d2ad3639](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d2ad3639](https://forums.unrealengine.com/u/anonymous_user_d2ad3639)\
**Post date:** [June 29, 2016, 7:31pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/1 "2016-06-29T19:31:11Z")

</div>

Hey guys, got a slight problem with my score system. i swear this worked and all of a sudden it has suddenly stopped working ! i basically have a system where at the end of a game i Set high score. On first attempt it set a new high score because the default is zero.

All good so far…

My rule in the blueprint is that it only sets a new high score if its greater than the previous score. It should then set a new previous score to be read in the next game. The problem is that it’s not setting my previous score. Previous score just stays at zero… so the branch always be TRUE and change the score each time even if i don’t beat it. this never happened before and did work so I can’t see where i am going from. Please help.

 ![96564-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/e/2beb4e599e9431625abd3f17f33e302a2b0a2ace.jpeg)

---

<div class="post-metadata">

**Author:** ![Krxtopher](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krxtopher](https://forums.unrealengine.com/u/Krxtopher)\
**Post date:** [June 29, 2016, 8:17pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/2 "2016-06-29T20:17:17Z")

</div>

Is this a level blueprint you’re showing us? Are “PreviousScore” and “HighScore” variables that are defined in the level blueprint?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d2ad3639](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d2ad3639](https://forums.unrealengine.com/u/anonymous_user_d2ad3639)\
**Post date:** [June 29, 2016, 8:20pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/3 "2016-06-29T20:20:12Z")

</div>

This is a class blueprint and the two variables are being cast from save game blue print. This did work before and I can’t see where I have gone wrong.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d2ad3639](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d2ad3639](https://forums.unrealengine.com/u/anonymous_user_d2ad3639)\
**Post date:** [July 3, 2016, 12:07pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/4 "2016-07-03T12:07:10Z")

</div>

Anyone have any ideas ?

---

<div class="post-metadata">

**Author:** ![Krxtopher](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krxtopher](https://forums.unrealengine.com/u/Krxtopher)\
**Post date:** [July 3, 2016, 4:20pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/5 "2016-07-03T16:20:22Z")

</div>

The first thing that strikes me as a problem is that in the graph above you are always resetting the high score to the player’s current score no matter what that current score is. Start by fixing that and then report back whether there are additional problems.

---

<div class="post-metadata">

**Author:** ![Mookaroni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mookaroni](https://forums.unrealengine.com/u/Mookaroni)\
**Post date:** [July 3, 2016, 10:33pm UTC](https://forums.unrealengine.com/t/not-updating-variable/362460/6 "2016-07-03T22:33:51Z")

</div>

As far as I can tell, your ‘set high score’ node seems to have an issue. It looks like you’re getting the high score of the BP\_SaveGame instead of the high score in the current graph.
