now what happening is that I have a character who has a raycast, and if raycast is colliding with the StaticBody and Z is pressed, this function gets called, when i press it once everything works but I cant make it work the second time and im really frustrated xD
how do i fix this? ;-;
Why are you doing it like this? You have a very weird approach. You are loading a script, but you’re not instancing it. The reason it only works the first time is that by the second time, the script is already loaded (I don’t really understand what you mean by “it’s working fine”, as there’s no way this actually works since the dialog isn’t added to the tree. Perhaps you mean that the dialog scene is working on its own, but that’s not what you’re loading, you’re only loading a script…). I suggest you take some time to read the tutorials, they’re very well done and you shouldn’t skip them.
What you should be loading (and then instancing) is the scene (probably named DialogBox.tscn). A script is, well, just a script file. It could be attached to any node, in any scene. You can’t load a script and expect it to fetch the scene you think it should be attached to. Instead you load the scene itself and instance it, and add it as a child.
“im really frustrated”
No wonder, you don’t understand the basics and you skipped the tutorials. I would be frustrated too.
OH SO THATS WHERE THE TUTORIALS WERE
okay thank you so much :0
im gonna go and read them
literallynick_ | 2020-11-11 15:22
No problem! And sorry if I sounded snappy, I wasn’t in my best mood. Best of luck!