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

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

Asked by 5 years ago
Edited 5 years ago

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.

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. MegaManSam1 207 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

Ad

Answer this question