First thing is to reliably detect whether you are jumping up into a block or not. Various ways of doing this, but basically check the direction you are moving in (x and y vector) and the relative position of your player and the block on collision. Then spawn the object you want to create.
Your block needs at least two animations for the before and after state (and some kind of instance counter if you want to replicate the Mario multiple coins in a block thing).. You can use a boolean instance to set the block "used up" state or you can use the current animation.