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)

func load_data():
	if FileAccess.file_exists(save_path):
		var file = FileAccess.open(save_path, FileAccess.READ)
		var stored_data = file.get_var()
		print(stored_data)
		value.text = stored_data.get("valuetext", "0")
		value.text = "2" #testing
		fish1 = stored_data.get("fish1", [])
		sanddollar = int(value.text)
		print("Loaded")

func _ready():
	load_data()

The code itself looks fine, are there any other scripts changing the label text?
Maybe try adding a new blank Label and see if that one works:

@export var value = Label
@export var test = Label

func sanddollar_caught():
	sanddollar += 1
	print(sanddollar) #testing
	value.text = str(sanddollar)
	test.text = str(sanddollar) # does this also not update?
	print(value.text) #testing

Where is the variable sanddollar declared and initialized?

You might try this:

func sanddollar_caught():
	value.text = str(int(value.text) + 1)