5 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

Code a story game

Lesson description: Start your coding journey with Roblox while joining millions participating in the world-wide Hour of Code™ initiative.

ISTE standards: Innovative Designer 4a, 4c, 4d, Creative Communicator 6b, 6d

Lesson objectives
  • Create variables for storing user input using Luau code in Roblox Studio.
  • Combine user input with a pre-written story.
  • Test and troubleshoot the resulting code.
Skills and concepts
  • Variable - A placeholder for information in code.
  • String - A variable that can store whole sentences, written in quotations.
  • Concatenation - Combining two strings into one using `..`
Prep
  • Download and prepare to play this Lesson Overview Video
  • Print out handouts and prep presentation
  • Optional - Ensure students have space to physically move to make motions for reference animations
Materials

Overview

Duration Activity Description
5 min Introduction Introduce the project and lesson structure.
5 min Guided Work: Create Stories Have students write their stories and create placeholders.
25 min Guided Tutorial: Story Games Lead students through a tutorial to build a story game.
10 min Independent Work: Finish Student Projects Let students catch up or continue building stories.
5 min Wrap-up Recap the lesson and have student shares stories

Lesson plan

Introduction

  1. Play this video about Hour of Code™, a nationwide initiative that introduces millions of students to one hour of computer programming.
  2. Tell students they will be building a game using Roblox Studio, the tool used to create all Roblox games. Students will write a story and then use user's answers to replace words and names. For example: One day [name] woke up and ate a giant [user's favorite food].
  3. Play the project overview video to show students the game they will create and build excitement.

Guided work - Create stories

  1. Provide students paper and pencil to write their stories.
  2. Lead students through Brainstorm your story.
    • Have students do this activity away from computers to reduce distractions.
    • Brainstorming Tip: Have students generate ideas by having one suggest a character (wizard, chef, etc), and another suggesting what that character does.

Guided tutorial - Story games

  1. Lead students through the tutorials starting at Open template and ending with Customize strings.

Independent work - Finish student projects

  1. Show students the tips and tricks from Customize strings.
  2. Have students catch up on their projects. If finished, add the following challenges, have them add two or more characters (each using a different variable: name2, name3).

Wrap up

  1. Recap what students have created and vocabulary: variable, string, concatenation.
  2. Encourage 2 or 3 students to verbally share the story they wrote as a class. For example, one student reads out the story and then calls on another student to provide an answer.

Appendix

Troubleshooting tips

General troubleshooting tips

Lesson 1: Create variables

Lesson 2: Get player answers

Lesson 3: Tell the story

Customize the lesson

Simplify the lesson

Expand the lesson

Miscellaneous resources

Below are questions to check for understanding in the content.

Lesson 1 questions Answer
A variable is ... A placeholder for information
What does scripts hold? Code to run programs
Name an example of a good variable name: `adjective03`, `name3`, `myVerb1`
Where in the script does the code need to be typed? Between the two green dashed lines
Lesson 2 questions Answer
Variables can hold more than one type of information. True or false? True
String type variables are sandwiched between what? Quotation marks
What can and cannot have spaces between them in your code? String contents can have spaces (like "`My name`"), variables cannot (like `name1`)
Lesson 3 questions Answer
What does concatenation do and how? Combines two or more strings/variables together using `..`

Course description

Discover how to build the ultimate interactive word game using Roblox's free coding and design tools. In this unique one-hour course, students will be able to explore the basics of computer programming and game design, then share their completed game online with friends to craft their own fun stories! Created specifically for students new to programming, this curriculum was developed in partnership between Roblox, the largest entertainment platform for user-generated 3D games, and Hour of Code™, a global movement that aims to broaden participation in computer science.

In this course, your student will: