Nonexistent function '...' in base '...'

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

can anyone pls help
i stiil get this message:
Nonexistent function instance in base ‘GDscript’

this is the script

extends Panel

var item = null
var ItemClass = preload(“res://”)

func _ready():
if randi() % 2 == 0:
item = ItemClass.instance()

:bust_in_silhouette: Reply From: yrtv
var ItemClass = preload("res://")

itemClass now has type GDScript.


GDScript does not have instance() method.

Without additional context answer end here. What are you trying to do?

i was trying to follow this tutorial
its on 5:32

and i still get this error

Castor1010 | 2021-02-08 05:23

:bust_in_silhouette: Reply From: Scavex
var ItemClass = preload("res://")

Take a good look. Here you need to preload a scene not a script ! Even in the tutorial it’s

var ItemClass = preload("res://Item.tscn")