And what is this code supposed to do ? THere are two functions here, one saves integer to a file, another read it from file. There is no function to actually use loaded variable to update your openlevs var.
This code looks fine. The only issue is that you’re sending “data” in as an argument and as a member variable (there will be a warning about this in the console): remove the var data = openlevs line.
You just need to call your methods. Let’s say you want to save when you press F5 and load when the game starts.
Loading
func _ready():
openlevs = load_val()
Saving
Go to project → project settings → input map (tab)
Enter save_level into “action field”, click add. Find “save_level” at the bottom of list, click “+”, then “key” and press F5.
func _input(event):
if event.is_action_pressed("save_level"):
save_val(openlevs)
Thank you! I am very grateful
I have been trying for 3 days now.
You saved me(no pun intended)
May god bless you
kitsune | 2022-01-07 13:47
Glad it helped. It’s all too easy to hit a brick wall when you first start. If you have free time in the evenings, try working through this excellent YouTube series, it should give you a solid grounding in the core concepts: