I’m not a very good scripter at all so I might not explain things good enough.
I’m trying to make my own NPC dialogue, and the script works fine, but it only works once.
So how it works is you click on the part that has a script and click detector in it, and once you click the part, it opens up the gui. This is the script inside the part you click:
This makes the frame for the dialogue visible, which is what I needed. Now, when the player is done reading what the NPC has to say, they click the button that makes the frame not visible. Here is the script:
So everything works fine, unless the player needs to re-read what the NPC had to say. This time, when they click on the NPC for a second time, nothing happens. There is no error in the output, and I can’t figure out why it doesn’t work after the first use. Please tell me what I am doing wrong, and if I didn’t explain something good enough, then please let me know.
What is script.Parent.Parent? It seems like you’re making a specific frame visible and turning something else invisible by accident, maybe the main (billboard/surface/screen)gui? I can’t be sure though, so it’d be great to have a bit more context.
Um I don’t know if this would fix it, but why in the world is the GUI located in the Player?? Please put it in the StarterGui, I don’t even know how it works in Player to be honest with you, if that doesn’t work please reply and I’ll try to help with that, have a great day and good luck!
Oh, your issue is that changes don’t replicate from the client to the server. You set Visible to false on the client, but it’s still true on the server. I’d handle the ClickDetector on the client too, if I were you, storing a new LocalScript in StarterPlayerScripts or something instead.
Move the ClickDetector related code into a LocalScript. (You can’t put it in the same place as the Script because LocalScripts don’t run in the workspace.)