UMG tracking two scores, need to compare one to the other but cant find a good node

Hey folks,

I have a UMG blueprint which functions as a score tracking HUD.
It tracks “Mass” of the player which is going to be linked to a size scaler and is reduced by 1 every #seconds.
Now I need “Highscore” to represent the highest count of “Mass

However I cant seem to find out how to compare this math.

IF Mass-20 >= Highscore - Highscore = mass

Here’s the blueprint that relays the Mass score to the static text
6ed0dd3d4d89d7ff990770bbdcbbfc0267fce030.jpeg

And heres the blueprint that’s supposed to do the same for the highscore
6745037366c7e3fccb27a002ec788ecad07cdf33.jpeg

As you can see I left the -20 out of the equation .
So it should return 20 to the Masscount variable and set highscore to 20, instead it sets highscore to 1.
How to make this work?

Not sure what you mean, your math equation is not in the right syntax, so it is hard to read.
Is this correct? :

if (mass - 20) >= (highscore - highscore), highscore = mass

Is that right? First of all, highscore - highscore will always be 0, so there is your first problem, what exactly is it you want to do with this math?

Just tell me what you want to do and I will write you an equation/post blueprint

You are casting a boolean value to float, so it will always give 0.0 or 1.0. You should use branch node and connect the compare pin to it. Then modify “Masscount” variable only when the condition is true. It should look something like this:

I want to use mass for highscore.
The game starts with 20 mass, cause 0 mass will trigger a gameover.
I want highscore to just depict the highest amount of mass you obtained.

But let me test that blueprint above^^

tested and works, see below.

On a side note, the Math i showed had a serious typo xD
“IF Mass-20 >= Highscore - Highscore = mass”
Shouldve looked like this
IF (Mass-20)>=Highscore than highscore = Mass

Thanks for the example.
I tried using a branch when I started this one, but didnt know where id get the red node from.
Completely forgot about it.

Mass is a variable in my character blueprint, so I’m using cast to to be able to pull that one out.
But heres the working result based on your example.