I can't understand the reason for this error in my code.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Oculus

Error: E 0: 00:04.247 _create_instance: Condition" r_error. error != Variant::CallError::CALL_OK" is true. Returned: __null

extends Node2D

onready var item = preload(“res://Scense/Items.tscn”)

func get_player():
return $Player

func _ready():
var items = [“stick”, “twig”, “stone”, “apple”]
for i in range(16):
randomize()
var a = int(rand_range(0,4))
var new_item = item.instance()
$Items.add_child(new_item)
new_item.set_item(items[a])
new_item.position = Vector2(int(rand_range(0,3231)), int(rand_range(0, 3228)))
pass

please use code-formatting {} for everthing that is code or contains _
Its very hard to read your text like this…

whiteshampoo | 2021-03-29 20:42

:bust_in_silhouette: Reply From: Inces

Error seems a bit weird, but I can see the line that causes it
You are instancing strings
You forgot about load() or preload()
It usually goes like this :

var stick = preload("res/scenes/stick.tscn")
var ins = stick.instance()
$items.add_child(ins)

By the way, this is how You should have formatted code part of text…