While making Cat Clicker 2, I needed to make a “previous costume” code. This is what I thought of, and it works. The code is in Sprite1. Scratch should just add a previous costume block though. :/
I hope this is useful to someone.