How do I place an object inside a scene from files after preforming an action?

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

Basically, I have a dialgue box in a scene(with a control node base), however I can’t just place it into an actual game scene, since it would show from the moment the game loads, so I need to place it inside the scene after entering an area2d and confirming the interaction by pressing ui_confirm

:bust_in_silhouette: Reply From: Moreus

but “you can put in actual scene” and put Visible to off and control with script

Instancing a scene(from redit):

var scene = load(“res://scenes/MyScene.tscn”)
var scene_instance = scene.instance()

sorry for the typo. However I’m pretty sure that even when it’s not visible, when I press ui_accept, the dialogues will continue, which I don’t want

iNeedMentalHelp | 2023-03-09 16:21

my bad, I only just read the whole comment. However I am getting this error:

The identifier “scene_instance” isn’t declared in the current scope.

iNeedMentalHelp | 2023-03-09 16:33

God I’m such an idiot. I copied it again, this time from reddit and now it works. The only problem is, I can still move during the dialogue. I’m thinking I need to set Pause mode to Process, but I don’t know how to do so using gdscript

iNeedMentalHelp | 2023-03-09 16:41

Nevermind, I already did it myself. Thanks for the help though!

iNeedMentalHelp | 2023-03-09 17:03