how do check if an of the children of a frame in a gui is clicked.
COMMUNITY QUESTION
Children of the frame?
2 answers
Well, you would use a generic loop. Example:
for i,v in pairs(script.Parent.Frame:GetChildren()) do
v.MouseButton1Down:connect(function()
print(v.Name.." was clicked")
end)
end
Please make your question more understandable. You cannot click frames, you need a TextButton/ImageButton.
local button = script.Parent.Button
button.MouseButton1Down:connect(function()
-- Your code here.
end)
If you want to find one of the frame's children:
local button = script.Parent.Button
local frame = script.Parent.Parent
button.MouseButton1Down:connect(function()
-- frame:GetChildren()
-- or
-- frame:FindFirstChild("NameHere")
end)
1 comment
0
Sorry if I didn't catch the question properly!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
It will only work for TextButtons or ImageButtons