Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

ClickDetector, how to use for GUI's?

Asked by
Ap_inity 112
8 years ago

I've tried using this script:

1function Clicked(Plr)
2Plr.PlayerGui.Gui.Frame.Visible=true
3end
4 
5script.Parent.MouseClick:connect(Clicked)

But, nothing happens. Help me please.

1 answer

Log in to vote
0
Answered by
blazar04 281 Moderation Voter
8 years ago

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.

1function MouseClick()
2    game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
3end
4 
5script.Parent.MouseButton1Click:connect(MouseClick)
Ad

Answer this question