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 Lua 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 ..
  • 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


5 minIntroductionIntroduce the project and lesson structure.
5 minGuided Work: Create StoriesHave students write their stories and create placeholders.
25 minGuided Tutorial: Story GamesLead students through a tutorial to build a story game.
10 minIndependent Work: Finish Student ProjectsLet students catch up or continue building stories.
5 minWrap-upRecap the lesson and have student shares stories

Lesson Plan


  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 experiences. 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 experience they will create and build excitement.

Guided Work - Create Stories

  1. Provide students paper and pencil to write their stories.
  2. Lead students through the lessons Writing the 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 Opening the Template. and ending with Finish and Add.

Independent Work - Finish Student Projects

  1. Show students the tips and tricks from Finish and Add.
  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.


Troubleshooting Tips

General Troubleshooting Tips

  • Introduce students to "Ask 3 Before Me": a student needs to ask three peers before asking the instructor for help.
  • Have neighbors test each others work. As they test, encourage students to look out for common errors like missing spaces in concatenation.

Lesson 1: Creating Variables

  • To help students better find the Story Manger script, draw the order on a display board: StarterGUI > GameGUI > StoryManager.
  • As students type in their first variable, make sure it's between the two dashed green lines. This will help avoid future errors.

Lesson 2: Getting Player Answers

  • Stress strict capitalization and spelling as students type words like storyMaker and GetInput. Having one letter misspelled or incorrectly capitalized will cause an error.
  • Remind students to press the Stop button whenever they're done playtesting.

Lesson 3: Telling the Story

  • As students type out sentences, they may notice extra spaces or some words combined together. String variables show literally everything between quotations.
  • If the story writes words that are combined like, "wizardNia", add an extra space before that variable.

Customize the Lesson

Simplify the Lesson

  • Have students focus on just writing one question, one sentence, and one variable.

Expand the Lesson

  • Have students include at least one technique from Tips and Tricks.
  • Allow students to trade places to play each other experiences when finished.

Miscellaneous Resources

Below are questions to check for understanding in the content.

Lesson 1 QuestionsAnswer
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 QuestionsAnswer
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 QuestionsAnswer
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 experience 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 experiences, and Hour of Code™, a global movement that aims to broaden participation in computer science.

In this course, your student will:

  • Learn and develop programming fundamentals with Lua.
  • Use programming to create a story game in a 3D world.
  • Take home a complete experience that can be played and shared online.