Hello, here is a short explanation. So, I want to create a GUI Button for my game that opens a frame when clicked, and when clicked again it makes the same frame invisible,
Here is the script that I made:
-- Variables
local clicked = 0
local updateLog = script.Parent.UpdateLogButton
local updateLogFrame = script.Parent.Title
-- Script
updateLog.MouseButton1Click:Connect(function()
clicked = clicked + 1
updateLog.MouseButton1Click:Connect(function()
if clicked == 1 then
updateLogFrame.Visible = true
end
if clicked == 0 then
updateLogFrame.Visible = false
end
if clicked == 2 or clicked <= 1 then
clicked = 0
end
end)
end)
It seemed to work fine at the start, when I clicked it, it showed the frame and when I clicked it again it made the frame invisible, but when I tried clicking it again (After it made the Frame Invisible.) it did not work ( It didn't make the frame visible again. ). Please help me solve this problem.

2 comments
Why is there so many scripts and parents? I don't understand
Ok So if you have a screengui thats 1 parent if you have a frame in that screengui thats 2 parents so if updatelogframe is in the 2nd frame and you wanna open it you put 3 parents