Displays the dice shuffling

I want to add a dice to my game. I would like it so that when I click the button named dice it quickly displays the numbers until it stops at a random number. How do I write this?

I did something with dice a few years ago, maybe it will help?

https://groups.google.com/g/mitappinventortest/c/OXIsZBO4DVk/m/YAwghFYPEAAJ

Is this the thing you wanted?