I need help on my first project in godot 4

i created a game and defined my assets properties each in their own scene and script but now i want to save and load high score when the player dies but it isn’t working i watched a lot of tutorials and in their video they defined everything both the player and enemy mechanism in their main scene/script which is not the case for me i defined my game properties each in their own scene any idea how i can solve this problem
This is what i mean


extends Node2D

var score: int = 0
const ScoreModifier: int = 10

var high_score : int = 0


func _ready() -> void:
	pass

	
func _physics_process(delta: float) -> void:
	score += 1

	if score > high_score:
		high_score = score
		
	show_score()

func show_score() -> void:
	$Score.get_node("ScoreLabel").text = "SCORE:  " + str(score / ScoreModifier)
	
	






My player script

extends CharacterBody2D

const JUMP_FORCE: int = -55
@export var GRAVITY: float = 6.0
var _velocity = Vector2.ZERO
var can_jump = true
@onready var ap = $AnimationPlayer
#@onready var sprite = $Sprite2D
const bullet_path = preload("res://scenes/Bullet.tscn")




func _physics_process(delta: float) -> void:
	_velocity.y += GRAVITY
	
	# PLayer jump
	if Input.is_action_just_pressed("ui_up") and can_jump:
		_velocity.y = JUMP_FORCE
		can_jump = false
		ap.play("jump_animation")
	
		
	if Input.is_action_just_pressed("ui_select"):
		shoot()
	var _velocity = move_and_collide(_velocity)


func shoot() -> void:
	var bullet = bullet_path.instantiate()
	
	get_parent().add_child(bullet)
	bullet.position = $Marker2D.global_position
	

func _on_area_2d_area_entered(area):
		can_jump = true
		ap.play("run_animation")

My first enemy script

extends Area2D

#Enemy speed 
var speed: = 1500

# Enemy animation 
@onready var anim = $AnimatedSprite2D

func _ready() -> void:
	anim.play()

func _physics_process(delta: float) -> void:
	#move enemy to the left
	global_position.x -= speed * delta 
	
	if position.x <= -500:
		queue_free()
 




func _on_area_entered(area):
	queue_free()

 



func _on_body_entered(body):
	get_tree().change_scene_to_file("res://scenes/GameOver.tscn")

My second enemy script

extends Area2D

#Enemy speed 
var speed: = 1000

# Enemy animation 
@onready var anim = $AnimatedSprite2D

func _ready() -> void:
	anim.play()

func _physics_process(delta: float) -> void:
	#move enemy to the left
	global_position.x -= speed * delta 
	
	if position.x <= -500:
		queue_free()
 



func _on_area_entered(area):
	get_tree().change_scene_to_file("res://scenes/GameOver.tscn")


My game over scene 

extends Node

var game_score: int
var high_score: int = 0

func _ready() -> void:
	if game_score > high_score:
		game_score = high_score
		print(game_score)

func free() -> void:
	var save_file = FileAccess.open("user://save.data", FileAccess.READ)
	high_score = save_file.get_32()
	game_score = save_file.get_16()

func _on_button_pressed():
	get_tree().change_scene_to_file("res://scenes/Main.tscn")

func show_score() -> void:
	$HighScore.text = "HighScore: " + str(high_score)

I can’t find the code to write into any file.
If you want to write into a file, use FileAccess.open("user://savegame.save", FileAccess.WRITE). There is also an example in the Godot docs.
And just a fyi: If you really want to save something cross the scenes, use Autoload Singletons instead.