Session Lesson Plan

2 - Coding Fundamentals

Developed by Roblox
Explore the coding concepts of functions, loops, and if/then statements with mini-projects that can be added to games like color changing platforms and traps.
10 and up Computer Science Game Design
English 1 hour
ISTE Standards: N/A

Learning Objectives:

  • Demonstrate the logic of if/then statements by modifying a part’s properties.
  • Practice troubleshooting by independently fixing issues in scripts as encountered.

Picture of Roblox player and code

Skills and Concepts:

  • Property - Something that controls how an object looks or behaves, like color or if players can walk through it.
  • Loop - A set of code that repeats until told otherwise.
  • Function - A set of instructions can be e re-used in different parts of a script.

Getting Ready


  • Download and open the Trap Project sample in Roblox Studio to show in the Introduction


Lesson Overview

5 min


Introduce the session.

20 min

Guided Tutorial
Working with Properties

Modify the color properties of parts using scripts.

35 min

Guided Tutorial
Coding a Trap

Code a trap using functions and if/then statements.

5 min

Wrap Up

Recap the lesson and concepts learned.

Lesson Plan

5 min
  1. Grab student attention by showing an example of the trap project.
    • Explain that trap was creating using scripting, which allows for the creation of many gameplay elements.
    • Will create other scripts, like one to change a part's color.
  2. Explain today's session will be different mini-projects to develop skills in scripting
    • Important to understand these concepts since adventure game will have more scripts.
    • Point out these projects, like a trap, can be included in the adventure game project they'll start in Session 3.
Guided Tutorial - Working with Properties
20 min
  1. Lead students through the following tutorials:
  2. Encourage students to troubleshoot independently if they have an error. To help, have them try:
    • Redoing their last few steps
    • Asking a peer for help
  3. As students write code, check that students write comments that accurately describe the code.
    • Not Specific: Runs code
    • Improved: Changes color of PracticePart
Guided Tutorial - Coding a Trap
35 min
  1. Lead students through the following tutorials:
  2. When working with if statements, check that students indent code to look like code samples. This helps make the code more readable, which becomes important as scripts grow larger.
Wrap Up
5 min
  1. Recap what students have created and vocabulary: property, loop, and function.
  2. Point out in the next session, students will start a new project where they make an adventure game.


Troubleshooting Tips

Coding a Trap

  • Remind students to double-check their capitalization or ask a peer to check their work. Even one incorrect letter can cause an error in longer words like FindFirstChildWhichIsA.
Classroom Management

Facilitation Tips

  • Try the following below to help students develop troubleshooting skills.
    • Write a partial line of code and ask students to complete it.
    • Purposely make a mistake in your code and ask students to identify the error. This can be easily turned into a game.
  • Emphasise 'Ask 3 Before Me' where students ask three peers before asking the teacher for help. It's important for students to become comfortable independently troubleshooting as they advance to more complex projects.
  • For students wanting a more specific brick color, you can share the RGB Color Calculator. Remember to type in the RGB Normalized decimal value for the color picked.

Timing Notes

  • Treat Functions 1 and Using If/Then Statements as quick practice lessons, each one lasting ideally five minutes. This will leave you more time for creating traps.
Customizing the Lesson

Simplify the Lesson

  • Picking a specific unique color can take some time. Whenever working with RGB colors, write down three numbers on a board as possible options for students. There are example colors in Properties and BrickColor - Using RGB Values.

Expand the Lesson

  • If students are done early, encourage them to add more colors to the loop for their color part. Challenge students to create specific brick colors using trial and error testing.
  • If students finished their traps, have them duplicate the Trap part and create an obstacle course with at least five different traps to avoid. 
  • The following activities can be included:
Misc. Resource

Previous String Variables Next Properties and BrickColor