Just a single
Sprite node? So, the
Sprite is the single, top-level node (and no other nodes)?
If so, is the above script attached to that
Sprite node? If so, you just want this:
texture = load(textures[Globals.store.selected])
$Sprite is attempting to access a child node, which doesn't exist...