Hi all,
What I'm attempting to do is connect a function to an event which will fire on different TextButtons which may be deleted for added at any time. The code that needs to be executed will remain constant however the instance on which the function will fire the event will change. Below I have made a quite frankly mediocre attempt, however I am hoping you guys have a bright idea on how to do this.
function OnClick()
-- relevant code.
end
sp.ChildAdded:connect(function(child)
child.TextButton.MouseButton1Click:connect(OnClick)
end)
sp.ChildRemoved:connect(function(child)
OnClick:Disconnect()
end)
Thanks in advance.

1 comment
Thanks pal