i believe you'd want to put it inside the "onPostBlockHit" event. something to note about this event is that even when you register it inside your custom block's lua script, it will still execute for
every block that gets hit, which means you have to compare the hit block's id to the id of your custom block before running any of the code (this is outlined within the
documentation, but not within the example block script itself even though it maybe ought to be).