Invalid access to property or key 'transform' on a base object of type 'null instance'

When searching for an answer online I couldn’t understand what I had to do to fix my own code. I want the Sprite2d2 to move according to the mouse position, while still in the confines of the player model, with a slight offset. I don’t know how to get the parent’s x and y position to use for in my clamps

Looks like node isn’t initialized. Try @onready node = get_parent()

3 Likes

Your correction was right but I also shouldn’t have written node.transform.position.x and .y
It should’ve been just node.position.x and .y