local Frame = game.StarterGui.ScreenGui.Frame
script.Parent.MouseButton1Click:Connect(function()
print("hi")
Frame.Visible = false
end)
COMMUNITY QUESTION
My script to set a frames visibility to true is not working. How do i fix this?
3 answers
I believe that you have to use a text or image button and then use .MouseClick
1 comment
0
I said that MouseClick is for ClickDetectors, it wont work with GUIs
Make sure you are having a local script and you are doing it wrong because you are getting the server's GUI which is not in the player. To get the player, type
local Frame = game.LocalPlayer.PlayerGui.ScreenGui.Frame
script.Parent.MouseButton1Click:Connect(function()
print("hi")
Frame.Visible = false
end)
Your script is probably wrong. Is your script IN your GUI ?
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
I don't think you can detect a click on a frame, try making it a text button or image button and doing .MouseClick
MouseClick is for ClickDetectors, using MouseButton1Down will work better.
MouseClick is also for buttons in GUI.
In every way, MouseButton1Down will work better.