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

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

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

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

i found this, but didn’t solve my problem

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

AXB | 2022-12-29 11:32

:bust_in_silhouette: Reply From: jgodfrey

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

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

Rayu | 2020-11-19 21:27

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

That $Sprite is attempting to access a child node, which doesn’t exist…

jgodfrey | 2020-11-19 22:29