xyz I am trying to instantiate the item scene in the main 2D scene of my game. I figured out the error; the var scene_to_instance was placed too high up in the code. Once I brought it down to line 15, in between the ready and instance_object functions, the game opens and runs. Now the problem I am facing is the fact that the item doesn't actually respawn after I collect it. This time, the debugger is giving me the following errors:
E 0:00:00:0619 load: res://word_pickup.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://word_pickup.gd
<C++ Source> scene/resources/resource_format_text.cpp:490 @ load()
E 0:00:00:0619 _load: Failed loading resource: res://word_pickup.tscn. Make sure resources have been imported by opening the project in the editor at least once.
<C++ Error> Condition "found" is true. Returning: Ref<Resource>()
<C++ Source> core/io/resource_loader.cpp:222 @ _load()
E 0:00:00:0620 set_path: Another resource is loaded from path 'res://word_pickup.tscn' (possible cyclic resource inclusion).
<C++ Error> Method/function failed.
<C++ Source> core/io/resource.cpp:75 @ set_path()
My guess is that I should be instantiating the scene from a different script. Currently I am attempting to instantiate the scene from a script attached to the scene itself. The script shown in the picture is attached to the word_pickup node on the left sidebar, which is a child of the main 2D root acting as the scene. Maybe I should try instantiating the object from the script attached to the main 2D root?