Why my bullet doesn't move?

Godot Version

Question

Hello, I am looking for help in this forum because I have had a problem for a long time in which when I press the fire button in my game, the bullet spawns but remains static.
Player Code:
extends KinematicBody2D

var gravity = 50
var direction = Vector2.ZERO
var visibility_time = 0.1
var is_visible = false
var timer = 0.0
onready var bullet_scene = preload(“res://scenes/Bullet.tscn”)
onready var weapon_sprite = $WeaponSprite
onready var bullet_spawn_position = $Position2D

func _physics_process(delta):
move()
direction = move_and_slide(direction, Vector2.UP)

if Input.is_action_just_pressed("shoot"):
	show_weapon_sprite()
	shoot()

if is_visible:
	timer += delta
	if timer >= visibility_time:
		hide_weapon_sprite()

func move():
gravity += 10
if Input.is_action_pressed(“right”):
direction.x = 500
elif Input.is_action_pressed(“left”):
direction.x = -500
else:
direction.x = 0

if Input.is_action_just_pressed("jump") and is_on_floor():
	gravity = -600

direction.y = gravity  

func show_weapon_sprite():
weapon_sprite.visible = true
is_visible = true
timer = 0.0

func hide_weapon_sprite():
weapon_sprite.visible = false
is_visible = false

func shoot():
var bullet = bullet_scene.instance()
get_parent().add_child(bullet)

Bullet code:
extends Area2D

var speed = 500
var direction = Vector2.RIGHT

func _ready():
set_process(true)
scale = Vector2(0.1, 0.1)
print(“Bala lista en posición:”, global_position)

func _process(delta):

global_position += direction * speed * delta
print("Posición de la bala:", global_position)

instead of

global_position += direction * speed * delta`

try:

global_position += transform.x * speed * delta

the only thing youll have to do now is when you spawn the bullet, set the bullet’s transform equal to the player or the guns transform (one or the other might need to be the global_transform or maybe both should be)

Hope this helps!