Saving doesnt work

Godot Version

4.2.2

Question

Hello! i tried making a working saving system for a time when you use speedrun-mode, but it just says:"Attempt to call function ‘store_var’ in base ‘null instance’ on a null instance.’ heres the code:

func save():
var file = FileAccess.open(save_path, FileAccess.WRITE)
file.store_var(h_sec)
file.store_var(h_milisec)
file.store_var(h_min)

var file = FileAccess.open(save_path, FileAccess.WRITE)
Can you print out the save_path? The error describes file to be null, which means that FileAccess could not find anything at save_path.
Does the file even exist?

well, no. how do i create the file? Edit i think i wrote something wrong

Ok, i actually wrote the path wrong. sorry about that

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.