Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When I click a button to open a gui it works the first time but not the second? (No errors)

Okay so I'm making a self check-in for an airline me and a few friends are working on. When I test the game and click a part it opens up the Gui. But when I close it and try to reopen it nothing happens and there is no errors. Here is the (server)script that I'm using:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local screenGui = player:WaitForChild("PlayerGui"):FindFirstChild("ScreenGui")
    screenGui.CheckinGUIStart.Visible = true
end)

pls help .-.

2 comments

0

erm is this a gui

0

yes

1 answer

✓ Accepted answer

Hi there,

Rather than toggling the visibilty of a UI, I would suggest instead cloning it into the Player's PlayerGui when they click the button. It's fairly simple, and would probably give you less struggles!

local gui = script.Parent.Gui -- Wherever your GUI is. Replace "Gui" with the GUI's name

script.Parent.ClickDetector.MouseClick:Connect(function(player)

	-- We clone the original GUI into the player's PlayerGui
	gui:Clone().Parent = player.PlayerGui

	-- We do not need to wait for the PlayerGui since that it has already loaded when the player's character loads
end)

Related documentation: Clone()

3 comments

0

When I clone it, it's still not visible

0

You probably have the frames' visible property disabled, enable it and everything should work smoothly!

0

If this solved your issue, please mark this answer as the solution :)

This discussion is preserved as it was. New answers, comments, and votes are closed.