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

Gui buttons

Asked by 10 years ago

I need help with guis button scripts When click the button

function mousebutton1down (click)

to open the gui and then i need a close button

button:remove()

Thanks if you can help

0
What exactly do you need ? Be more precise please. Hippalectryon 3 — 10y
0
Please do not spam tags. Thanks! User#2 0 — 10y
0
i didnt spam tags... i only put one User#210 0 — 10y

1 answer

Log in to vote
2
Answered by
badcc 30
10 years ago
local frame = ... -- Be sure to replace these two with proper variables.
local button = ... 
button.MouseButton1Down:connect(function()
  if frame.Visible then -- Short-hand for 'if frame.Visible == true'
    frame.Visible = false
  else
    frame.Visible = true
  end
end)

If you would like for the GUI to tween, you can learn more here. If you have any questions on them, feel free to reply.

http://wiki.roblox.com/index.php?title=TweenPosition

0
Thanks @badcc so my frame would be local frame = script.Parent and the button is local button = script.parent.parent? User#210 0 — 10y
Ad

Answer this question