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
7 years ago

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

Log in to vote
0
Answered by
blazar04 281 Moderation Voter
7 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.

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

script.Parent.MouseButton1Click:connect(MouseClick)

Ad

Answer this question