Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I click a part for a GUI, it works, but when I do it a second time, it doesn't. Help?

Asked by 3 years ago

So, I'm making a click part for a gui. Here's the code.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    player.PlayerGui.ChooseGui.Frame.Visible = true

end)

And, I click on it. It works completely fine. Then, I click the exit button I made, (Which makes the frame false, doesn't destroy it.) and it exits. I click on the part again, but the GUI just won't pop up again. Any help?

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Well, the only reason I can think of why this wouldn't be working is if you're using this Server Script to change the frame's visibility to true, and then you're using a Local Script to change it to false. If you are doing it this way, the reason why it won't work is because on the server the frame's visibility is still set to true, where as on your client it's set to false and the server can't see that. Server Scripts can only see things on the server, not the client. You can fix this by changing your exit button script to a Server Script.

0
Oh my god, thank you so much! :) It worked super well. lqveries 17 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

As xInfinityBear said, your only problem is most likely the difference for the client and the server. If you want to make it so only the client (player) who clicked can see the Gui or for the whole server to see then use RemoteEvents, otherwise use his solution

Answer this question