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

How do i make a Gui pop up on a click detector?

Im trying to make a GUI That opens on a click detector, I have the opening and closing sequence done but after i close the GUI It wont open again, Does anyone know how to fix this?

Opening Script:

local function click(player)
	player.PlayerGui.ScreenGui.Frame.Visible = true
end

script.Parent.ClickDetector.MouseClick:Connect(click)

Closing script: (inside a TextButton)

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

1 answer

✓ Accepted answer

Use LocalPlayer instead.

local player = game.Players.LocalPlayer

local function click()
    player.PlayerGui.ScreenGui.Frame.Visible = true
end
	 script.Parent.ClickDetector.MouseClick:Connect(click)

Don't forget to accept the answer if I helped!

3 comments

0

I forgot to mention, make sure it's in a LocalScript.

1

Thank you

0

No problem! Always happy to help!

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