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 8 years ago
Gui.Frame.ButtonA.MouseButton1Down:connect(function()
    Call()
end)
Gui.Frame.ButtonB.MouseButton1Down:connect(function()
    Call()
end)
Gui.Frame.ButtonC.MouseButton1Down:connect(function()
    Call()
end)

function Call()
end

Thank you!

1 answer

Log in to vote
1
Answered by 8 years ago

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

for _,v in pairs(Gui.Frame:GetChildren()) do
    v.Button1Down:connect(function()
        Call()
    end)
end
0
This isn't working. It only goes through once rather than constantly waiting for a Button1Down to fire. zabba7461 5 — 8y
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 — 8y
Ad

Answer this question