Hello,
The wiki page for addEventHandler provides a good description of this parameter: "The handler will only be called when the event it is attached to is triggered for this element, or one of its children.". To understand this, you need to be familiar with the Element Tree. Basically, the attachedTo parameter allows you to restrict the events to a particular element. If I have, for example, 3 GUI buttons, If I were to attach an onClientGUIClick to the Root Element, it would be triggered when any of the 3 buttons are clicked. However, if I attach the same event to just one of those 3 buttons specifically, it will only get triggered when that specific button is clicked. To know what element to attach an event handler to, look at the Source section on the event's wiki page. For events like onClientClick, it says: "The source of this event is the client's root element." . The root element is on the top of the element hiearchy, therefore your only option here is to attach it to the root element. As mentioned before, with an event like onClientGUIClick, you can attach it to the root element to receive GUI click events from ANY resource, you can attach it to getResourceRootElement() to receive GUI click events from only THIS resource, or you can attach it to a specific GUI element and only get events from that single element. Of course, you can always attach an event to any element you like. With custom events (say, showLoginGui like yours) it's important to consider how the event will propagate. If you have the same event registered in two different resources and have both attached to the Root Element, you couldn't really control which one you want to trigger. The Event System page provides a good description of how this works exactly, I highly recommend you read it.