[SOLVED] OriginalText changes, but the text displayed on screen doesn't

I have a text element on screen which should show the current score of the player, but although the float score changes the text on screen does not. I checked if the text element is null, it isn’t, the TextRenderer isn’t null and the really strange thing is that when I use getOriginalText I get the score, so it seems like the text has changed. However there is no change at all on the screen.

score += (metersPerSecond * tpf);
int round = Math.round(score);
scoreText.getRenderer(TextRenderer.class).setText(String.valueOf(round));
                System.out.println(scoreText.getRenderer(TextRenderer.class).getOriginalText());

The part code is called in update every frame, the last line outputs the current score, but rounded.

scoreText = nifty.getCurrentScreen().findElementById(“scoreText”);

The code above is where I set the scoreText, scoreText is an Element.

<text id="scoreText" text="Hello" font="Interface/Fonts/Arial.fnt" align="center" valign="bottom" height="90%"/>
This is the code that creates the textfiel, it’s placed inside a panel. The text: “Hello” never changes.

I have no clue at all of what the problem can be, so all the help is welcome.

Never mind, I found the problem. I accidentally set the scoreText to something else, also a text element after I had set it to the right element. My bad!

1 Like