• Building
  • Export the final score to a .txt file ?

Hy community,

is there a simple solution to export the final score to a .txt file ?

thanks a lot !!

a year later
func save_score(save_path, score): # The path must end with .txt to create a txt-file
	var f = File.new()
	f.open(save_path, File.WRITE)
	f.store_line(to_json(score))
	f.close()
func read_score(save_path) -> float:
	var score: float
	var f = File.new()
	f.open(save_path, File.READ)
	score = parse_json(f.get_line)
	return score

If you need to save data that doesn't need to be read in other programs (for interoperability reasons), consider using the ConfigFile class instead of JSON. Unlike JSON, ConfigFile is strongly typed and can serialize any Godot datatype out of the box.