Thanks, sorry for the delay. I didn't see your response until now.
The error is in line 62. You are passing the NPC "p" to the "touch" function and later use it in block:hit as a 2nd argument. The 2nd argument to block:hit, however, only accepts players. The fix is to do v:hit(true, p) when p is a player, and v:hit(true) if not.