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

[SOLVED]Detect when different UI buttons are clicked in one script?

So the question is pretty straight forward, just wanting to know if theres a better way and faster way of doing it instead of

local button1 = button1 -- just a bunch of buttons and then detecting when each seperate one is clicked
local button2 = button2 

or looping through a frame that has the buttons in it and detecting a click.

1 comment

0

I would just use a loop that creates a MouseButton1Click event for each button, i'm unsure if there's a more efficient way or not.

1 answer

Instead of looping just use this if thats what you mean I'm not completly sure what you need help with but this might help:

button1.MouseButton1Clicked:Connect(function()
	-- your code here
end

Please put [SOLVED] in your title if this helped.

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