How do I load a my save file?

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

Before I start, I just wanted to say that I’m still a pretty big noob when it comes to Godot and coding in general.
I want to be able to save some text inside a label and load that same text again. I found this thread which seemed handy as it did not involve as much code as other saving methods.
So I tried to use the code that makes a my_scene.tscn file so I can save the text in my label, the problem is that if I want to load this code so we can continue with our “game” it gives some error messages.
we used this code for the saving:

extends TextureButton
onready var Paneel = get_node("Panel")

func _onready():
    var packed_scene = Paneel

func _on_TextureButton4_pressed():
    var packed_scene = PackedScene.new()
    packed_scene.pack(get_tree().get_current_scene())
    ResourceSaver.save("res://my_scene.tscn", packed_scene)

And this code for loading:

Extends TextureButton
onready var Paneel = get_node("Panel")

func _onready():
    var packed_scene = Paneel

func _on_TextureButton5_pressed():
    var packed_scene = load("res://my_scene.tscn")
    var my_scene = packed_scene.instance()
    add_child(my_scene)

When I press my save button I do not get any error messages but when I press the load button, it gives us the following error messages (again, I’m a noob).

0:00:18:0877 - res://my_scene.tscn:7659 - Parse Error: 
----------
Type:Error
Description: 
Time: 0:00:18:0877
C Error: res://my_scene.tscn:7659 - Parse Error: 
C Source: scene\resources\scene_format_text.cpp:277
C Function: ResourceInteractiveLoaderText::_parse_node_tag

0:00:18:0880 - Condition ' err != OK ' is true. returned: RES()
----------
Type:Error
Description: 
Time: 0:00:18:0880
C Error: Condition ' err != OK ' is true. returned: RES()
C Source: core\io\resource_loader.cpp:149
C Function: ResourceFormatLoader::load

0:00:18:0884 - Failed loading resource: res://my_scene.tscn
----------
Type:Error
Description: Failed loading resource: res://my_scene.tscn
Time: 0:00:18:0884
C Error: Method/Function Failed, returning: RES()
C Source: core\io\resource_loader.cpp:186
C Function: ResourceLoader::_load

I do not know for sure what any of these mean, any help or referral to a better solution of saving a simple line of text would be much appreciated.

You can click on on the error messages and usually see a stack_trace. Can you get more information out of it with that, also you can copy the error message, with right click and post that. Makes it easier to use google.

Maybe you haven’t changed the scene between saving and loading and that may be a problem?

coffeeDragon | 2018-07-25 08:52

Ahh okay, I updated the post with all of the error messages.

What exactly do you mean by changing the scene? Switch to a different scene or like change a node or something in the current scene?

5Dee | 2018-07-27 07:45