This error arises from the fact that your saying text = ""
. This is converting the Label
to type String
because you haven't statically declared the variable type. You should always use text.text
when you want to change the actual content of the label, not just assign the whole object to an empty string. What you've told the editor to do is to convert the dynamic variable to a new string instead of representing the original object. You need to always use Label.text = ""
if you want to change the text of the label without reassigning the variable to a different data type.
Here is my scene, I have a label named "stats".
In my script, I've statically typed the variable as type Label
this ensures that I can't accidently reassign the variable to a different data type in the future. If I do the editor will give me an error. By saying text = ""
instead of text.text=""
you have essentially changed the data type of the variable to be an empty string, and it no longer represents the original node. That's why you keep getting "Invalid type in function 'interpolate_property' in base 'Tween'. Cannot convert argument 1 from String to Object." Because you've essentially converted the variable to a String. interpolate_property
expects an Object as its first argument, not a String.

As you can see, if you just always use text.text = ""
you will never get this problem.
As you'll notice in the video tutorial you provided, they specifically always use Label.text = ""
for this exact reason, you can't do Label = ""
, that's just not how you access the text property of the label.
I suggest you check the official docs to get more information on dynamic and static variables in Godot: https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_advanced.html