i’m trying to make a frame/button that becomes invisible and then another frame/button that becomes visible, I got the first part done but I don;t know how to do the second part
local onClicked = script.Parent -- parent of check
local makeVis = script.Parent.Parent.check_box -- what will become visible
onClicked.MouseButton1Click:Connect(function()
onClicked.Visible = false -- becomes false
wait(0.01) -- wait before visible
makeVis.Visible = true -- becomes true
-- trying to make it so if they click again its the oppisite
onClicked.MouseButton1Click:Connect(function()
onClicked.Visible = true -- becomes ttrue
wait(0.01) -- wait
makeVis.Visible = false -- becomes false
end)
end)
Like @Ok6c said, you don’t need two events. You can use a debounce that’s switched on or off when you click the button. Here’s what it could look like:
local onClicked = script.Parent -- parent of check
local debounce = true
local makeVis = script.Parent.Parent.check_box -- what will become visible
onClicked.MouseButton1Click:Connect(function()
if(debounce) then
debounce = false
onClicked.Visible = false -- becomes false
wait(0.01) -- wait before visible
makeVis.Visible = true -- becomes true
else
debounce = true
onClicked.Visible = true -- becomes ttrue
wait(0.01) -- wait
makeVis.Visible = false -- becomes false
end
end)
local onClicked = script.Parent
local makeVis = onClicked.Parent[check_box]
onClicked.MouseButton1Up:Connect(function()
onClicked.Visible = not onClicked.Visible
wait()
makeVis.Visible = not makeVis.Visible
end)
local onClicked = script.Parent
local makeVis = script.Parent.Parent.check_box
local Clicked = false -- this is to check if they've clicked once or twice
onClicked.MouseButton1Click:Connect(function()
if not Clicked then
Clicked = true
OnClicked.Visible = false
wait(0.01)
makeVis.Visible = true
else
Clicked = false
OnClicked.Visible = true
wait(0.01)
makeVis.Visible = false
end
end)
local onClicked = script.Parent
local makeVis = script.Parent.Parent.check_box
local isOpen = false
onClicked.MouseButton1Click:Connect(function()
if not isOpen then
isOpen = true
onClicked.Visible = false
wait(.01)
makeVis.Visible = true
if isOpen then
isOpen = false
onClicked.Visible = true
wait(.01)
makeVis.Visible = false
end
end)