Script won't update position

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By scooty

Hey, I’m trying to get my script to print the player’s position each time it clicks but it just keeps printing the same initial position

onready var PlayerMan = get_parent().get_node("Player").position

func _input(event):
if event.is_action_pressed('Fire'):
	PlayerMan = get_parent().get_node("Player").position
	target_position = PlayerMan

Are you changing the Player.position in your Player’s script?

All you’re doing is printing the Player node’s position in that code excerpt, if Player.position is not updated elsewhere, it’s working as written.

timothybrentwood | 2021-05-05 01:09

:bust_in_silhouette: Reply From: magicalogic

You either need to use get_global_position() if your player is a KinematicBody and you are not changing its position directly (e.g using move_and_slide()) or maybe you are not moving your player at all as @timothybrentwood says.