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

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

Asked by 4 years ago
local Frame = game.StarterGui.ScreenGui.Frame


script.Parent.MouseButton1Click:Connect(function()
    print("hi")
    Frame.Visible = false
end)
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 NickIsANuke 217 — 4y
0
MouseClick is for ClickDetectors, using MouseButton1Down will work better. CocoTheSniper 0 — 4y
0
MouseClick is also for buttons in GUI. NickIsANuke 217 — 4y
0
In every way, MouseButton1Down will work better. CocoTheSniper 0 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

I believe that you have to use a text or image button and then use .MouseClick

0
I said that MouseClick is for ClickDetectors, it wont work with GUIs CocoTheSniper 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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)
Log in to vote
-1
Answered by 4 years ago

Your script is probably wrong. Is your script IN your GUI ?

Answer this question