I tried to make a download and save in Godo4
Did in this lesson for Godo3.x:
https://gdscript.com/solutions/how-to-save-and-load-godot-game-data/

Script 1

extends Resource

class_name GlobaDataSave

@export var player_name = "Unit"
@export var score = 234
@export var level = 11

Script 2

extends Node
#	Save and Load
var gameSave

func _ready():
#	Create an instance of the class
	gameSave = GlobaDataSave.new()
	
#	Output the default value
	print(gameSave.player_name)
	print(str(gameSave.score))
	
#	Change the value in gameSave
	gameSave.player_name = "Alex"
	
#	Save the file with the new value
	var result = ResourceSaver.save(gameSave, "user://save.tres",ResourceSaver.FLAG_COMPRESS)
	assert(result == OK)
	
#       Checking for Save    ????????????????
	func load_data(save):
	 if ResourceLoader.exists("user://", "save.tres"):

#	Output a new value
	print(gameSave.player_name)
	print(str(gameSave.score))

How do I create a check for and load a save file ????

  • Then I will leave the working version of the script:
    Script 1

    extends Resource
    
    class_name GlobaDataSave
    
    @export var player_name = "Unit"
    @export var score = 234
    @export var level = 11

    Scrpt 2

    extends Node
    #	Save and Load
    var result
    var gameSave
    @export var savePatch = "user://save.tres"
    
    func _ready():
    #	Create an instance of the class
    	gameSave = GlobaDataSave.new()
    	
    #	Checking for save file and load save 
    	if ResourceLoader.exists(savePatch):
    		print("load gameSave")
    		gameSave = ResourceLoader.load(savePatch)
    #		return gameSave
    #		if the file is missing in "user://"
    	else:
    		print("new gameSave")
    		
    #	Edit a new value
    #	gameSave.player_name = "Alex"
    #	gameSave.score = gameSave.score + 1
    
    #	Output a new value
    	print("name:  " + gameSave.player_name)
    	print("score: " + str(gameSave.score))
    	
    #	Save the file with the new value
    	result = ResourceSaver.save(gameSave, savePatch,ResourceSaver.FLAG_COMPRESS)
    #	result = ResourceSaver.save(gameSave, savePatch,ResourceSaver.FLAG_BUNDLE_RESOURCES)
    	assert(result == OK)

You need to indent line 28 by one more tab for correct formatting, as otherwise it is not part of the function.

For what to input into the exists function, it depends on the file path you are using to save the file. The first argument is the file path to the file you saved (you can ignore the second, I think).

For example: if you saved a file at “user://file.txt” then you would want the first argument to be “user://file.txt“. Likewise, if you saved a file at “res://saves/temp.txt”, then the first argument would be “res://saves/temp.txt“.

I just noticed you tagged this for Godot 4.9. I’m not sure if the syntax for Godot 5.9 has changed but I would encourage you to check the documentation for Godot 4.0 to see.
(I also might recommend not using Godot 4.0 for learning new techniques or following tutorials at this point - it isn’t really stable yet and there are a lot of changes compared to Godot 3.X)

Edit: just checked and the function in Godot 4.0 works the same way as Godot 3.X according to the documentation.

How can I delete this topic?

I can remove it, but why delete it? Wouldn’t it help others who may have the same (or similar) question?
I mean, if you want it deleted I can and will, but…

Then I will leave the working version of the script:
Script 1

extends Resource

class_name GlobaDataSave

@export var player_name = "Unit"
@export var score = 234
@export var level = 11

Scrpt 2

extends Node
#	Save and Load
var result
var gameSave
@export var savePatch = "user://save.tres"

func _ready():
#	Create an instance of the class
	gameSave = GlobaDataSave.new()
	
#	Checking for save file and load save 
	if ResourceLoader.exists(savePatch):
		print("load gameSave")
		gameSave = ResourceLoader.load(savePatch)
#		return gameSave
#		if the file is missing in "user://"
	else:
		print("new gameSave")
		
#	Edit a new value
#	gameSave.player_name = "Alex"
#	gameSave.score = gameSave.score + 1

#	Output a new value
	print("name:  " + gameSave.player_name)
	print("score: " + str(gameSave.score))
	
#	Save the file with the new value
	result = ResourceSaver.save(gameSave, savePatch,ResourceSaver.FLAG_COMPRESS)
#	result = ResourceSaver.save(gameSave, savePatch,ResourceSaver.FLAG_BUNDLE_RESOURCES)
	assert(result == OK)