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

How do you make a button do something?

Asked by 10 years ago

Like I want to script it.

EX: I pressed the "Play" button, and it deletes the message.

I know everything, but the ending part. (Last line) I want to know it.

1 answer

Log in to vote
1
Answered by 10 years ago
-- Make sure this is in the button
Gui = Script.Parent.Parent.Parent --LOCATE THE WHOLE GUI HERE
function OnClick()
    Gui.Visible = false
end
script.Parent.MouseButton1Click:connect(OnClick)

--OR
Gui = Script.Parent.Parent.Parent --LOCATE THE WHOLE GUI HERE
function close()
    Gui:destroy()
end
script.Parent.MouseButton1Down:connect(close)

--EITHER OF THEM WORK. YOU ONLY NEED 1. Make sure this is the button's child
1
That was helpful. groovydino 2 — 10y
0
Thanks. If you wish, could you please consider this as the Correct Answer if you think so? fahmisack123 385 — 10y
Ad

Answer this question