I guess that applies to almost anything, no? Once you're gone, no matter whether it's a Minecraft server or whatever, the worst thing that can happen to you is to be forgotten.
It's fairly simple: Place the function block anywhere you want, and the call function block (insure they're linked with the same name) at the end of the code line linked to the right click event.
I'm not on the server rn, so I can't get an image, but look for the lapis items in your inventory. (The ore being the codeblock that calls, or activates, the function, and the block being the function itself)