How to get a reference to the GUI element that was interacted with?
I have a frame which has a left and a right frame within (or image/button.)
I'm trying to connect the children frames to a function which in turn needs to reference the frame called the function. The input parameter only provides information about the delta, keycode, position, user input state and type.
Is there any way to find out which frame was clicked? (Other than having to compute it using the coordinates of each frame?)
01 | local parentFrame = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame |
02 | local leftFrame = parentFrame.LeftFrame |
03 | local rightFrame = parentFrame.RightFrame |
05 | local function foo(input) |
12 | leftFrame.InputBegan:Connect(foo) |
13 | rightFrame.InputBegan:Connect(foo) |