Marker2D is not moving

Godot Version

Question

`extends Sprite2D

@onready var muzzle = $MuzzleFlash
var closest_target = null
var range = 800
var bullet = preload(“res://Scene/bullet.tscn”)
var fire_rate : float = 0.1
var fire_timer : float = 0.0

func _ready():
muzzle.emitting = false

func _process(delta):
fire_timer += delta
if fire_timer >= fire_rate:
fire_timer = 0.0
_shoot()
if global.shooting == true:
muzzle.emitting = true
muzzle.restart()
if global.shooting == false:
muzzle.emitting = false

func _shoot():
var enemies = get_tree().get_nodes_in_group(“Enemy”)
if enemies.size() == 0:
return

closest_target = null
var closest_distance = INF
for enemy in enemies:
	var distance = global_position.distance_to(enemy.global_position)
	if distance < closest_distance:
		closest_distance = distance
		closest_target = enemy

if closest_target and closest_distance <= range:
	global.shooting = true
	var mermi = bullet.instantiate()
	var muzzle_position = $Muzzle.global_position
	var direction = (closest_target.global_position - muzzle_position).normalized()
	var target_angle = direction.angle()
	
	self.rotation = target_angle
	
	if direction.x < 0:
		self.flip_v = true
	else:
		self.flip_v = false
	
	mermi.global_position = muzzle_position
	mermi.rotation = target_angle
	get_tree().get_root().add_child(mermi)
else:
	global.shooting = false

` here is code

Can you show your scene tree?

So i assume the muzzle isn’t moving because the bullets are in the wrong place? when you check the position of the muzzle what value is it?