In this beginner-friendly tutorial, we’ll learn how to build a dice app with MIT App Inventor. It’s a fun coding project for kids that uses lists and logic to show a random dice image at the tap of a button, the kind of mini-app you can build into your own board game. MIT App Inventor is a great platform for kids since it is considered one of the best block coding platform for beginners.
If your child enjoys little build projects like this dice app, the live coding classes at SkoolOfCode walk kids through MIT App Inventor, Scratch, and Python step by step, so they finish each session with something they actually made.
Design the Front end of the App
To start with, we will first design the front end of the app as shown below.

To do this, open up MIT App Inventor and create a new project named “DiceRoll”. We will need 6 images for six dice numbers. A sound file will be played when the dice is rolled. Upload all the 6 images and sound files (Tada.mp3) to the project from the ‘Media’ section.

Change the screen Title property to the name of the app “Roll the Dice”. Add an Image, Button, and Label component. Add a non-visible component Player from the Media category. Change the property of the component as shown in the table below.
| Component | Property |
| Image | Height:200 pixel Width:200 pixel Picture:d1.png |
| Button Rename it to ‘DiceRoll’ | BackgroundColor: any color of your choice Text: Roll the dice |
| Label | BackgroundColor: any color of your choice FontSie:18 Text: Click on the button to Roll the dice |
| Screen | BackgroundColor: any color of your choice AlignHorizontal: Center AlignVertical: Center |
| Player | Source: Tada.mp3 |

Building the screen layout is the easy part. The fun begins when kids wire up the blocks and see random numbers turn into real dice rolls. If you want your child to learn that side of app building with a teacher guiding them, take a look at the small group classes at SkoolOfCode.
The logic of the app
Now, we move to the blocks and add the logic of the app. We will be using the concept of List in this app. To know more about List, click on this link List Doc. Create a variable of type List which will store all the 6 dice images as a list item as shown below.


Please note that the dice image file names added in the List should be exactly same as the file uploaded in the project.
Blocks for the DiceRoll Button click event
Add the Click event for the DiceRoll button and add the logic to display a random dice image by getting a random item from the List.

Display the dice image on the Image component

Play the sound using the Sound component

Testing the app
The app is finished, and the AI companion can be used to test it. When the button is clicked, a random dice image and a sound will appear.
Things to try
- Roll the dice when the phone is shaken(Hint: use Accelerometer sensor)
- Create a double dice app

This dice rolling app can be a very useful tool in the game development courses for kids where they can create the game around this app. We can create a multi-player dice game or a game where the movement of the character is determined by the dice for e.g. race game. The possibilities are endless, we just need to explore and start working. So, if you want your child should learn all this Book a FREE trial class today.
Frequently Asked Questions
What is MIT App Inventor?
MIT App Inventor is a free, beginner-friendly platform that lets kids build real mobile apps using drag-and-drop code blocks instead of typing text-based code. It is one of the most popular ways to introduce young learners to app development.
Can kids really build their own apps with it?
Yes. MIT App Inventor is designed for beginners, so kids can build working apps like this dice app by snapping together visual blocks. No prior coding experience is needed.
What coding skills does this dice app project teach?
This project teaches core programming concepts including lists, variables, event handling, randomness, and basic app interface design, all through building a simple, playable app.
How long does the dice app project take?
Most kids can build the dice app in about 30 to 45 minutes by following the step-by-step instructions. Exploring the extra challenges at the end can extend the project.
What age is MIT App Inventor good for?
MIT App Inventor works well for kids roughly ages 8 and up. Younger children can follow along with guidance, while older kids can extend the app with more advanced features.
By – Vineeta Chaudhary, an Educator at SkoolofCode with B.E in Computers. She is an expert in block-based coding which includes platforms, like Scratch, MIT App Inventor, and Thunkable.