This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote
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 (137 points)

i had a similar problem here, did you had solve this problem? if so, pls let me know :D

1 Answer

+2 votes
Best answer

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

by (22,704 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 Frequently asked questions and 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 [email protected] with your username.