0 votes
var textures = [
            'res://Emojis/Emoji_set1/EyeClosed_Smiley_120x120.png',
            'res://Emojis/Emoji_set2/Frog_130x130.png',
            'res://Emojis/Emoji_set3/Cool_Emoji120x120.png',
]   

func _ready() -> void:
    Globals.load_store()
    $Sprite.texture = load(textures[Globals.store.selected])  <---- Error

Invalid set index 'texture' (on base: 'null instance') with value of type 'StreamTexture'

i found this, but didn't solve my problem
https://godotengine.org/qa/65367/invalid-index-texture-base-null-instance-value-streamtexture

in Engine by (133 points)

1 Answer

+1 vote
Best answer

Your $Sprite node reference is null. You need find out why that is...

by (10,894 points)
selected by

this Scene has 1 node and it is a Sprite and it is called Sprite how can it be null ??

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])

That $Sprite is attempting to access a child node, which doesn't exist...

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.