Cannot get a nodes position via a unique name

Aha. Unique names are sadly only useful within the scene the script is used. %player only works for the script on your node “level”. Not for spawned enemies.

You will need a new way to find the player, groups aren’t a bad bet, you could try this once you assign your player to a group

var player: CharacterBody2D
var player_starting_position: Vector2

func _ready() -> void:
    player = get_tree().get_first_node_in_group("MyPlayerGroup")
    player_starting_position = player.position
1 Like