TextureProgress not showing bar length correctly

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Help me please

Hi everyone!
I have a texture progress node and now I am trying to update its bar as below

$TextureProgress.value = Globals.coins
$TextureProgress.max_value = Globals.coins_max

I also have a Autoloaded script (i.e. Globals) with these variables

var coins : int = 500
var coins_max : int = 500

So it should show the full bar but its showing a very small portion of the total length of bar. I don’t find any mistake but still the bar is not showing the correct length.
Thank you!

:bust_in_silhouette: Reply From: Yuminous

Heya!

So… this will sound pretty silly, but I think the solution is to simply swap these lines:

$TextureProgress.max_value = Globals.coins_max
$TextureProgress.value = Globals.coins

What’s happening (I think) is that because you set your value before you set your new max value, it instead gets set to the previous max (e.g., 100).

Thus when you set your new max, what’s displayed is only a fraction of the total.

Hope it helps!