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

How Do I Make A Gui Toggle Button?

Asked by 10 years ago

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

Log in to vote
0
Answered by
KAAK82 16
10 years ago

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)
0
Thanks for your help! alienantics 15 — 10y
0
np, also, don't forget to Click the Accept Answer Button :D KAAK82 16 — 10y
Ad

Answer this question