How to instance a script

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

I made a script for holding questions and answers to beused for the main scene but i i dont know how ever time i try it says its not instancing i did var preload var script=Script.instance but nothing is working can someine explain what i doing wrong
If you would like to see the code just ask.

Can we see the code?

Zylann | 2018-02-27 13:52

:bust_in_silhouette: Reply From: rustyStriker

You don’t instantiate a script you do it to nodes, you can add a script to an instanced node or a pre existing one, but you will need to set all the commands you need in the _ready function(such as set_process(true) and all of them)…

:bust_in_silhouette: Reply From: Nyenye

Look at this example: Godot Docs - Background loading. It uses a script, and instead of .instance(), i calls .new(). Probably that’s your error.

# initialize
queue = preload("res://").new()