The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hi there.
For some reason my game don't save when i export it.
in the console say this:

ERROR: File must be opened before use.
At: core/bind/core_bind.cpp:2245

The code for save:

extends Node

var BestScore = 0

var Save = {
    BS = null}

var saveFile = 1
var SDirectory  =  str("res://Saves/save", saveFile)    

onready var ExitPause = get_node("ExitPause")

func _ready():
    if load_data():

func save_data():
    var file =,file.WRITE_READ)

# and load
func load_data():
    var file =
    if not file.file_exists(SDirectory):
        return false,file.READ)
    Save = file.get_var()
    return true

func thingsToSave():
    Save = {
        BS = BestScore

func thingsToLoad():
    BestScore = Save.BS

Player function that saves:

func dead():
    var _RC = get_tree().reload_current_scene()
Godot version 3.2.3
in Engine by (75 points)

1 Answer

+1 vote

You need to use user:// instead of res://

You can read here why.

by (1,536 points)

Still doesn't work :(

Is it the same error?

yes, but know it not even give me the error

You have to give us more information...

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.