Teaching when to use MyBlocks
Four relatively easy ideas would be to:


Conduct periodic code reviews where you point out style issues like these. If you make code reviews a regular thing, the repetition should hopefully help students eventually start using functions independently. Since your students are in elementary school, this should obviously be a very lightweight and informal code review.
Develop an automatic style checker for whatever language you're using to perform these sorts of style checks for them. (Hopefully, whatever language you're using is exportable into a text-based or otherwise structured format that actually does permit this sort of analysis.)
Heavily emphasize that if the students are at any point copying-and-pasting, they're doing something wrong. Make it clear that copying-and-pasting is a sin. (This is assuming whatever language you're using is actually usable enough to make this a truth rather then a lie.)
Give them a short style guide to follow; include a note about eliminating redundancy using functions/myblocks in the style guide. This will probably be more effective with older students.


If you have control over how students learn to code, a broader (and probably more effective) strategies would be to teach students how to use your MyBlocks/functions first and foremost, almost before anything else. 

That is, teach them the absolute bare minimum functionality to make something happen, then teach them how to decompose a large problem into smaller subtasks, and have them create a MyBlock for each subtask. I would do this first, before teaching them things like control flow, variables, etc... Basically, make the idea of "refactoring" and "identifying subproblems" one of your first lessons.

The hope is that if you make using functions/MyBlocks one of your very first lessons, they're less likely to pick up the bad habit of writing redundant code.