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

ClickDetector, how to use for GUI's?

I've tried using this script:

function Clicked(Plr)
Plr.PlayerGui.Gui.Frame.Visible=true
end

script.Parent.MouseClick:connect(Clicked)

But, nothing happens. Help me please.

1 answer

✓ Accepted answer

You don't use click detectors on GUIs. Also, a frame can't detect a mouse click. If you were trying to make a button then you would want to create a screen gui and insert a text button, or a frame with a text button inside. It is good to have your output open (go to the view tab and click output) so you can view your errors. You can not return the player on a gui, it would just return the players mouse. Inside a button your script would look like this in a local script.

function MouseClick()
	game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
end

script.Parent.MouseButton1Click:connect(MouseClick)

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