In your script player
is a variable that contains a reference to the parent of the node the script is connected to. To use it in the connect
code, you don't want to preface it with the $
sign, as that's just syntactic sugar to reference a node in your scene tree called player
, which I assume doesn't exist...
So, really, just drop the $
sign in the connect
code.
player.conect(...)