Trying to set global position of node2d

Godot Version

Godot 4.4

Question

Trying to set global position of instanced node2d to position of a marker2d. It’s an explosion effect that would show up when hitting an enemy, but keep getting this error.

“Invalid assignment of property or key ‘global_position’ with value of type ‘Vector2’ on a base object of type ‘PackedScene’.”

The code (let me know if you need anymore):

extends Area2D
@export var bboom_effect : PackedScene
@onready var marker_2d: Marker2D = $Marker2D

var speed = 300

func _process(delta):
    position += transform.x * speed*delta


func _on_visible_on_screen_notifier_2d_screen_exited():
    queue_free()

func rocket_explosion_effect():

    var explosion_effect_instance = bboom_effect.instantiate()
    print(is_instance_valid(explosion_effect_instance))
    bboom_effect.global_position = marker_2d.global_position

    get_parent().add_child(explosion_effect_instance)
    #bboom_effect.position = Vector2.ZERO
    queue_free()

func _on_body_entered(body: Node2D):
    #if "kego" in body.name:
    if body.is_in_group("enemies"):
        queue_free()
        rocket_explosion_effect()




According to your description, you want to set the global position of explosion_effect_instance.
But in your code, you set the global position of bboom_effect.

This seems like a contradiction. Did you mean the following?

explosion_effect_instance.global_position = marker_2d.global_position

Thank you LOL