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

Is there a better way to write this?

Asked by 9 years ago
01Gui.Frame.ButtonA.MouseButton1Down:connect(function()
02    Call()
03end)
04Gui.Frame.ButtonB.MouseButton1Down:connect(function()
05    Call()
06end)
07Gui.Frame.ButtonC.MouseButton1Down:connect(function()
08    Call()
09end)
10 
11function Call()
12end

Thank you!

1 answer

Log in to vote
1
Answered by 9 years ago

Assuming that Call() is the same function in every instance;

1for _,v in pairs(Gui.Frame:GetChildren()) do
2    v.Button1Down:connect(function()
3        Call()
4    end)
5end
0
This isn't working. It only goes through once rather than constantly waiting for a Button1Down to fire. zabba7461 5 — 9y
0
You didn't think I was going to give you free cake, did you? You have to try and work it into the script yourself. SquirreIOnToast 309 — 9y
Ad

Answer this question