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

How Do I Make A Gui Toggle Button?

I know how to make the Gui toggle from visible to not visible using TWO buttons, but I can't figure out how to do the same thing using only ONE button. Here is how to do it using two buttons:

Visible button:

function onClick()
Gui = game.StarterGui.ChatGui.Frame.TextBox
Gui.Visible = true
end

script.Parent.MouseButton1Down:connect(onClick)

Not visible button:

function onClick()
Gui = game.StarterGui.ChatGui.Frame.TextBox
Gui.Visible = false
end

script.Parent.MouseButton1Down:connect(onClick)

Can anyone show me how to make this into ONE toggle button?

1 answer

easy :p

function onClick()
Gui = game.StarterGui.ChatGui.Frame.TextBox

if Gui.Visible == false then
Gui.Visible = true
else
Gui.Visible = true
end
end

script.Parent.MouseButton1Down:connect(onClick)

2 comments

0

Thanks for your help!

0

np, also, don't forget to Click the Accept Answer Button :D

This discussion is preserved as it was. New answers, comments, and votes are closed.