3 min read

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

Coding fundamentals

Lesson description: 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.

Lesson objectives
  • Demonstrate the logic of if/then statements by modifying a part's properties.
  • Practice troubleshooting by independently fixing issues in scripts as encountered.
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.

Overview

Duration Activity Description
5 min Introduction 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 Reflect on project and recap concepts learned.

Lesson plan

Introduction

  1. 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 - Work with properties

  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 - Code a trap

  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

  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.

Appendix

Troubleshooting and classroom tips