Hello! I’m still fairly new to Godot, and I don’t understand why the text for my Label won’t update.
Here is the code from my Autoload scene:
@export var value = Label
func sanddollar_caught():
sanddollar += 1
print(sanddollar) #testing
value.text = str(sanddollar)
print(value.text) #testing
I’m trying to call the function to update the label text for value, and it isn’t a problem with the function not being called as both print commands work (with their correct values), but even though it’s printing value.text correctly as the updated value, the displayed text isn’t.
Loading value.text works fine (displays “2” but stays as “2” after sanddollar_caught function is called)
The label I’m trying to edit is sanddollar_score > scoreboard > value, and the main node MainScene is my Autoload script, and I’m trying to call the function in Control2 > Fishing... script
So you have it as autoload aswell as run it as your game-Scene?
This means you are loading this scene twice. You can run your game and then click on “Remote” in the godot editor and see your game-scene-tree. There should be two MainScene-nodes which are basically a copy of each other.
i suggest to remove the autoload main-scene and just keep the MainScene as your main-loaded scene and see what happens
How do I just remove the Autoload-MainScene (@Node@2)? Are you saying I should transfer my code into a different scene and assign that as the autoload instead?