So far I have this script
local gui = script.Gui
script.Parent.MouseButton1Click:Connect(function()
gui.Enabled = false
end)
I have gotten the gui to open on a click but now I can't get it to close when I use this script. What am I doing wrong?
local gui = script.Gui script.Parent.MouseButton1Click:Connect(function() if gui.Visible == true then gui.Visible = false else gui.Visible = true end)
Please accept my answer if I helped!
ok I'm just gonna say you have many errors but the smart thing is to do is to make the script a child of the gui so it should be like this
local gui = script.Parent gui.MouseButton1Click:Connect(function() gui.Enabled = false end)
or try doing this its more complicated but it will do the function in the whole gui again make the script a child of the gui
local guitable = script.Parent:GetChildren() local gui = script.Parent gui.MouseButton1Click:Connect(function() for i, v in pairs(guitable) do v.Visible = false end
Try using this code: (I wrote this code on scripting helpers, please tell me if there is any errors.)
local gui = script.Parent script.Parent.MouseButton1Down:Connect(Function() gui.Enabled = false end)
If there are any errors let me know.