I tried my best to follow the documentation online. Here is what I have:
func save_high_score(high_score):
var path = "user://HighScore.dat"
var file = File.new()
file.open(path, File.WRTIE)
file.store_string(str(high_score))
file.close()
func load_high_score():
var path = "user://HighScore.dat"
var high_score = 0
var file = File.new()
if file.file_exists(path):
file.open(path, File.READ)
high_score = int(file.get_as_text())
file.close()
return high_score
I'm not really getting a helpful error message, just that the game crashes when the savehighscore function is called. Thanks in advance for any help!
EDIT: I wasn't clear about this before, but the load function appears to function correctly, just not the save one.
EDIT 2: I am just dumb lol. I misspelled WRITE as WRTIE. Everything works now lol.