Saving and loading destructable object

Godot Version

4.2.1

Question

I tried to save in my game which of the coins on the field should still be there but i couldn’t find a solution. Here is the code I tierd:
`
extends Area2D

var path = “user://” + self.name + “.save”
var exist = true

func _process(delta):
$AnimatedSprite2D.play()

func _on_body_entered(body):
if body.name == (“player”) && exist:
body.getCoin()
exist = false
self.hide()

func save():
var file = FileAccess.open(path, FileAccess.WRITE)
file.store_var(exist)

func load_data():
var file = FileAccess.open(path, FileAccess.READ)
exist = file.get_var(exist)
if exist:
self.show()
else:
self.hide()
`

(you want to use ``` instead of just ` for code blocks)
Where do you call save() and load_data()? You have defined them, but you didn’t show where you call them.