Just go to sprite "code" and add the block to your backpack (If you just got confused by that word, which I bet most of you didn't, then look here https://scratch.mit.edu/projects/148684047/ {Sorry. It's from Scratch 2.0 days, but the UI is about the same besides slight differences in positions and a large difference in age!}). Then, to use the script, for each sprite you use it in, drag it in and set the variable "sprite_name." You can mess with it and discover. I suggest that, for full experience, you create a "z-index list (Modify the code if you are some maniacal genius making a CSS interpreter in Scratch!) I hope it works well for you! Look inside to see the script in action!
I made this because don't we all suffer from an unintuitive layer positioning system on Scratch! Tell me improvements you want and I'll gladly make them.