So first of all, you'll need two copies of the NPC. One of them will say the thing before hitting the block, the other one will say the thing after hitting the block. Put them onto two separate layers, then put them both in the same place (to do so, hide the first NPC and put the second NPC where the first NPC was hidden, then reshow the first NPC). Now open the Events window, and make an event that hides the first NPC, and shows the second NPC. Make sure "No Smoke" or "Disable smoke transition" (depending on whether you're using SMBX or PGE) is checked. Now go to the block you want to hit, and under the "Events" window, under "Hit", select the event you just made. You're good to go!