Hello! I tried loading a dictionary, and i see why it caused an error. but i dont know how to fix it the code:
func load_skins(): if FileAccess.file_exists(save_path_skins): var file = FileAccess.open(save_path_coins, FileAccess.READ) skins = file.get_var(skins)
heres the error: Invalid type in fun function ‘get_var’ in base ‘FileAccess’. Cannot convert arguement 1 from dictionary to bool.
i tried, but it doesnt work. heres the variable:var skins = {"freddy" : false, "mat" : true, "don" : false, "miki":false} and another part of the script where the new error showed up:`func on_select_miki_pressed():
if skins[“miki”] == true:
$“/root/CharSelect”.character = "miki"
elif skins[“miki”] == false:
if coins >= 50:
coins -= 50
skins[“miki”] = true
save_skins()
Sorry, use JSON.stringify(skins) at save_skins function (instead of to_json(skins)) and JSON.parse_json(fileContent) at load_skins function (instead of parse_json(fileContent)).
Looking into your original post.
Looks like you are checking if save_path_skins file exists, but then you Open an read from save_path_coins.
Have you corrected that? because in that case you are reading froma different file with, most likely, a different format.