Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a better way to write this?

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

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

2 comments

0

This isn't working. It only goes through once rather than constantly waiting for a Button1Down to fire.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.