I don't understand why I getting this error, the node is there but the editor keeps telling the node instance is null. It would be helpful if someone could point out where the problems is, thank you.
ERROR: Invalid set index 'texture' (on base: 'null instance') with
value of type 'StreamTexture'
onready var sprite = $Sprite
export var type = 0 setget set_texture
type = newSprite
if type == 1:
sprite.texture = load("res://Image/Door01.png")
if type == 2:
sprite.texture = load("res://Image/Door02.png")