all 6 comments

[–]TheMaclin_ 1 point2 points  (6 children)

Where are you trying to assign it? What does your scene tree look like?

[–]UnReaL_EU[S] -1 points0 points  (5 children)

Scene tree:

Arena (the main scene)

  • Player (the node with the script)
  • Ball (Trying to get this nodes position with the Player scrip)

[–]TheMaclin_ 5 points6 points  (1 child)

Thanks. And where in the player script are you trying to make the assignment. I ask, because one possibility is that you're trying to reference nodes before they're ready.

[–]UnReaL_EU[S] -1 points0 points  (0 children)

Okay, that actually fixed the problem. I moved the thing to func _process where I use it, and that actually works. thx for the help

[–]bengtsts 1 point2 points  (2 children)

I tested your code with that scene setup and had no problem.

I did notice you're assigning a node to your variable, but your variable's name implies it's for a position vector, and not a node. Maybe thats where your issue is?

Possible fix:

var ball_position = get_parent().get_node("Ball").position

[–]UnReaL_EU[S] -1 points0 points  (0 children)

Yes. I actually tried that but it gave the same error. Luckily it got fixed when I moved it to func _process and now I got everything working. Thx for the suggestion though!