Overwrite file opened with FileAccess

Godot Version

4.2

Question

Hey I’m trying to ovewrite an already created save file. But changes are not saved when using store_line. The first save (when the file doesn’t exist) the data is stored correctly. dataToSave is a JSON variable.

func save_game(fileNumber):
	var savegame = FileAccess.open("user://savegame_" + str(fileNumber) +".save", FileAccess.WRITE_READ)
	var dataToSave = saveData()
	var json_string = JSON.stringify(dataToSave)
	savegame.store_line(json_string)

when i see save and load issues, i always recommend to just use plugin GitHub - AdamKormos/SaveMadeEasy: An easy to use, versatile Save/Load System for Godot 4 inspired by the simplicity of Unity's PlayerPrefs. Supports nested variables, Resources, Arrays and encryption.

the implementation

you can also learn what did you miss on saving or loading user data from this plugin save_system.gd
but why not just use it?