Help with downloading files

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Comet

(Sorry for my English, I use Google translator)
Created a save system, the file is saved normally, but I can’t load it, how can I do it?
Global variable:

func save():
var file = File.new()
if file.open("user://saved_game.txt", File.WRITE) != 0:
	print("Error opening file")
return
file.store_string(player.txt)
file.close()

func load():
   var file = File.new()
   if not file.file_exists("user://saved_game.txt"):
	   print("No file saved!")
	   return
   if file.open("user://saved_game.txt", File.READ) != 0:
	   print("Error opening file")
	   return

Another script:

onready var p = Global.player

func _ready():
    $Button.connect('pressed', self, 'saving')
    $Button2.connect('pressed', self, 'loading')

func saving():
    p.name = $LineEdit.text
    Global.save()
    print('saved')
func loading():
    Global.load()
    $Label.text = p.name
:bust_in_silhouette: Reply From: Schweini

You shouldn’t create a new file in the load func. See this tutorial for more infos: https://m.youtube.com/watch?v=EteQMVK2joI