Try moving the File.new() assignment inside the save_data() function?
I tried to put the
file = file.new()
inside save_data() function
but got the same result…
juanMAMAW | 2020-09-29 07:33
Oh right, res:// is inaccessible during runtime. You can’t open files in it when you run the program. Try saving files in the user:// directory instead.
I encountered this error when I forgot to call file.Close() when initially reading/loading data in _Ready(). Later, when I tried to save and write to the file, the error was thrown.