Godot Version
4.6
Question
as the title says I'm trying to have text change when a button is pressed specifically when the button is pressed the number displaced on a label decreases, the issue is though when I actually press the button in the game it crashes and I receive the error "Invalid assignment of property or key ‘text’ with value of type ‘String’ on a base object of type ‘null instance’.”
this is the current code I’m using
func _on_button_pressed():
var my_label = $Label
my_label.text = “whatever I want”
it comes from me looking at a 6yr old reddit comment and what google ai popped up with.
thanks in advance for any help