GUI shows once, but never again

I have a click detector that when clicked, opens a GUI. When you close that gui from the client, you can never open the GUI again.

Serverscript:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	player:WaitForChild("PlayerGui").MusicGUI.Enabled = true
end)

Localscript:

if success and result and result.AssetTypeId == 3 then
	script.Parent.Parent.Enabled = false
end

Hello @Towren Can you please elaborate?

So, when you click a part in the workspace, a GUI opens, nothing going wrong. I close the gui in the local script, nothing going wrong. But when I try to open the gui from the part again, it will not open.

It’s because on the server the gui is seen to be still enabled = true and since the value is still enabled = true there’s no need to change it. Only on the client it is seen as enabled = false. Since it is not changed it does not send a message to the client to replicate it. A hacky fix to it would be to do

script.Parent.ClickDetector.MouseClick:Connect(function(player)
player:WaitForChild("PlayerGui").MusicGUI.Enabled = false
player:WaitForChild("PlayerGui").MusicGUI.Enabled = true
end)

but a better way without having to turn it off and on in the server would be to keep it all on the client. So when you click the part have it fire a remote event to the client to make the GUI visible.

1 Like

you could just make a local script and do like workspace.Part.ClickDetector it would work the same :blush:

1 Like