PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

1 hour

Code Your Own Story Game

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

Course Overview

Learning Objectives:

  • Create variables for storing player input using Lua code in Roblox Studio.
  • Combine player input with a student created story.
  • Test and troubleshoot the resulting code.

Terms 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 ..

Materials:
Prep:

Lesson Timing

Time Lesson Description
10 min INTRODUCTION Introduce the project and Hour of Code™ initiative.
5 min GUIDED WORK
Create Stories
Have students write their stories and create placeholders.
25 min GUIDED TUTORIAL
Story Games
Have students write their stories and create placeholders.
15 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 10 min
  1. Play this informational video about Hour of Code™, a nationwide initiative that introduces millions of students to one hour of computer programming.
  2. Play the Project Overview video to introduce the project students will create and build excitement.
  3. Going to build a game in Roblox Studio, tool used to build all Roblox games.
    • Will write a story and then make placeholders to replace parts of that story.
    • For example: One day [person] woke up and ate a giant [food].
GUIDED WORK
Create Stories 5 min
  1. [Optional] Provide students paper and pencil to write their stories.
  2. Lead students through Writing the Story and Creating Placeholders.
    • 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 25 min
  1. Continue by leading students through Lesson 1 - Opening the Template.
  2. Lead students through Lesson 2 - Asking Questions.
  3. Lead students through Lesson 3 - Write the Story.
    • Encourage students to check that each concatenation has two dots (..)and that their capitalization matches the example script, especially for words like storyMaker.
INDEPENDENT WORK
Finish Student Projects 15 min
  1. Show students Lesson 3 - Finishing the Story > Tips and Tricks.
  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 5 min
  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 and Resources

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.

Customizing 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 games when finished.

Check for Understanding Questions

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

Miscellaneous Resources

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 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 game that can be played and shared online.

Promotional Poster (Download)

Feel free to use this 8.5x11 print out to advertise your eventevent.


Useful Links


The Hour of Code™ is a nationwide initiative by Computer Science Education Week and Code.org to introduce millions of students to one hour of computer science and computer programming. These documents are licensed by Roblox Corporation under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Roblox, Powering Imagination, and Robux are trademarks of Roblox Corporation, registered in the United States and other countries.