I'm pretty sure stuff does not work like that in GdScript for
simple data types. Because what you want to do is have a pointer to your value instead of having it saved. In C++ you it would be straight forward, on the other hand, in GdScript, all that is handled by the interpreter and you can't simply do it.
As a work around, you can create a
class that holds a value, your int for example and use instances the class to access the values. This works because any instance of a class is a complex object, thus accessed by reference.