1: var myvar setget my_var_set, my_var_get
3: func my_var_set(new_value):
4: my_var = new_value
6: func my_var_get():
7: return my_var # Getter must return a value.
On line 1, you are creating
myvar for this script.
On line 4, you are setting the script level, line 1,
myvar with the value new_value.
On line 7, you are getting the script level, line 1,
For your code to work you need to move the
var check outside the setter, so it becomes a script level variable.
Just a basic how code works because who knows, maybe it helps, whenever you open a new context, in case of gdscript, add 1 tab. Whatever new
var whatever you declare dies the moment you exit the context and whatever is in the context above, at least one less tab, can be accessed by whoever is in the internal context.