To close a file, use the close method:
close
file.close()
To read from a file, use the get_as_text or other get_* method:
get_as_text
get_*
var file = FileAccess.open("user://save_game.dat", FileAccess.READ) var player_name = file.get_as_text() print(player_name)
To write to a file, use the store_string, store_line or other store_* methods:
store_string
store_line
store_*
var player_name = "Septian" var file = FileAccess.open("user://save_game.dat", FileAccess.WRITE) file.store_string(player_name)