1 min read

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

Conditionals

Series description

Many games have actions that only take place if a list of requirements are met. You may have seen rooms only specific teams could enter or inventory items only some players could purchase. This series will cover how to set up code that says, "If this happens, then do that."

Objectives and prerequisites

Learning Objectives Understand the logic behind `if` `then` statements and how to set up multiple scenarios with the keywords `elseif` and `else`.
Prerequisites Before beginning this course, readers should be able to navigate Roblox Studio, as well as declare new variables and functions.

Series contents

Article Description
[Intro to If Statements](/docs/roblox-tutorials-fundamentals-coding-3-intro-to-if-statements) Learn how if statements work and how to code them in Luau.
[If Statement Practice: Trap Parts](/docs/roblox-tutorials-fundamentals-coding-3-traps-with-if-statements) Use conditionals to create better traps that only hurt avatars and humanoids.
[If Statement Practice: Power Ups](/docs/roblox-tutorials-fundamentals-coding-3-powerups-with-if-statements) Practice using `if` statements and create a part that increases the players' walking speed.
[Multiple Conditions](/docs/roblox-tutorials-fundamentals-coding-3-multiple-conditions) Design code that accounts for multiple scenarios with `else` and `elseif`.
[Multiple Conditions Practice: Awarding Points](/docs/roblox-tutorials-fundamentals-coding-3-give-points) Use everything learned about conditionals to create a part that can award points to players.