Every onClientGUIClick event handler's attachment needs propagate set to false:
addEventHandler("onClientGUIClick", theButton, function()
-- ...
end, false -- add a false after the function's end (4th argument of addEventHandler)
)
Otherwise the event is attached to the given element's/button's element tree, meaning the event being triggered on any child element or parent element will trigger the handler, which is not what you want with GUIs.
The other workaround is, in each function, adding an if-block with condition checking the event's source (this isn't the most efficient though, since the function will still be called unnecessarily, just that it won't do anything.
addEventHandler("onClientGUIClick", theButton, function()
if source == theButton then -- verify the event's source is the button you attached this function to
-- do whatever the function does
end
end)