I want to make something happen when one of several buttons is clicked. All the buttons are text buttons, parented to a frame. The following code gives me an error like this: attempt to index field "MouseButton1Click" (a nil value)
Any help on how to make this work would be appreciated.
local buttons = script.Parent.Frame:GetChildren()
buttons.MouseButton1Click:connect(function()
print("It works!")
end)
- I checked the wiki-- MouseButton1Click is a valid event of the TextButton object, so I don't think that's the problem :V

2 comments
Thank you :D Very well stated answer. It works like a charm! Thanks for the links as well :P
No problem :3