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?)
local parentFrame = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame local leftFrame = parentFrame.LeftFrame local rightFrame = parentFrame.RightFrame local function foo(input) --how can I get the frame that was interacted with in here? --local clickedFrame = ??? --code goes here... end leftFrame.InputBegan:Connect(foo) rightFrame.InputBegan:Connect(foo)
local parentFrame = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame local leftFrame = parentFrame.LeftFrame local rightFrame = parentFrame.RightFrame local function foo(input, frame) --how can I get the frame that was interacted with in here? --local clickedFrame = frame --code goes here... end leftFrame.InputBegan:Connect(function(input) foo(input, leftFrame) -- or just do foo code here idk end) rightFrame.InputBegan:Connect(function(input) foo(input, rightFrame) -- or just do foo code here idk end)