Can select items in store but it doesn't load

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rayu

Globals Script

var store = {
			'bought' : [true, false, false],
			'selected': 0, 
}

var save_store_path = 'user://save'

func save_store():
	var file = File.new()
	file.open(save_store_path, file.WRITE_READ)
	file.store_var(store)
	file.close()
	
func load_store():
	var file = File.new()
	if not file.file_exists(save_store_path):
		return false
	file.open(save_store_path, file.READ)
	store = file.get_var()
	file.close()
	return true

Items script

extends Tabs

onready var price2 = str2var($RichTextLabel/control/Panel2/Label.text)
onready var price3 = str2var($RichTextLabel/control/Panel3/Label.text)

func _ready() -> void:
	Globals.load_store()
	for item in range(panels.get_child_count()-1): 
		if Globals.store.bought[item] == true:
			panels.get_node('Panel'+str(item+1)).get_node('Button').text = 'select'
	panels.get_node('Panel'+str(Globals.store.selected+1)).get_node('Button').text = 'selected'
	panels.get_node('Panel'+str(Globals.store.selected+1)).get_node('Button').add_to_group('selected')

func _selected(node, no):
	Globals.load_store()
	for buttons in get_tree().get_nodes_in_group('selected'):
		buttons.text = 'select'
		buttons.remove_from_group('selected')
	node.text = 'selected'
	node.add_to_group('selected')
	Globals.store.seleceted = no
	Globals.save_store()

func _buy(price, item_no):
	Globals.load_store()
	if Globals.store.bought[item_no] == false:
		if Globals.Score >= price:
			Globals.Score -= price
			Globals.store.bought[item_no] = true
			panels.get_node('Panel'+str(item_no+1)).get_node('Button').text = 'select'
			Globals.save_store()
		else:
			var rem = price - Globals.Score
			printt(rem)
	else:
		_selected(panels.get_node('Panel'+str(item_no+1)).get_node('Button'), item_no)


func store_button1_pressed() -> void:
	_buy(0, 0)

func store_button2_pressed() -> void:
	_buy(price2, 1)

func store_button3_pressed() -> void:
	_buy(price3, 2)

When i enter the Store i can buy 1 (of 3 items).
When i buy it and restart the Game it recognizes that i’ve bought it.
I can than select 1 of the 3 items and only 1 of them will be selected
BUT after i select item 2 or item 3 and change the scene to the Main scene it resets to item 1

It doesn’t recognize that i have selected other items