Need help with GUI

Hello, I am currently making a system where you can click a piece of paper and a GUI appears on your screen. A button next to it also appears to exit.


That works fine. However, once you click the button to exit, and when you click on the paper again, you can’t open it back up. I’ve tried everything I could think of and it’s probably a simple fix.
Code (server script inside GUI):

local Note = game.Workspace.Note
local ClickDetector = Note.ClickDetector

ClickDetector.MouseClick:Connect(function()
	script.Parent.TextLabel.Visible = true
	script.Parent.ClosePaper.Visible = true
	script.Parent.CloseSound:Play()	
end)

Code in Local Script:

local button = script.Parent

button.MouseButton1Click:Connect(function()
	script.Parent.Parent.TextLabel.Visible = false
	script.Parent.Parent.ClosePaper.Visible = false
	script.Parent.Parent.PaperPickUp:Play()
end)

Hierarchy:
image
If you think you know what went wrong, please let me know. Have a wonderful day!

1 Like

Remove any server side management of this. All GUI’s are entirely client-side. The server should have nothing to do with them except if the server needs to send a message to a client to display a GUI (and even then, the client does the donkey work). All GUI’s should be scripted locally, this includes: creating, destroying, managing, changing, showing, hiding, etc…

1 Like

Whenever I switch the code over to a LocalScript, I get this error:
image
Workspace hierarchy:
image

The server always kicks into action before the client, you may need to pause a little client-side until game.Workspace.Note has had a chance to replicate from the server to the client.

That worked! Thank you! Have a good night!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.