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

My script to set a frames visibility to true is not working. How do i fix this?

local Frame = game.StarterGui.ScreenGui.Frame


script.Parent.MouseButton1Click:Connect(function()
	print("hi")
	Frame.Visible = false
end)

4 comments

0

I don't think you can detect a click on a frame, try making it a text button or image button and doing .MouseClick

0

MouseClick is for ClickDetectors, using MouseButton1Down will work better.

0

MouseClick is also for buttons in GUI.

0

In every way, MouseButton1Down will work better.

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.