๐ŸŽฏ GOAL:

Learn how to use more Lua keywords to make a trap, an automatic door, and a blinking warning light that plays a custom-recorded sound.

๐Ÿ”ง What Youโ€™re Making Today:

  1. An disappearing door that lets players through

  2. A deadly floor trap

๐Ÿง NEW KEYWORDS TO LEARN

๐Ÿ”น while

What it means:
Tells the computer to keep repeating something over and over โ€” like a loop โ€” until the computer is told to stop.

Say it out loud:

โ€œKeep doing this until I say stop!โ€

๐Ÿ”น ==

What it means:
Double equals, or equality. This asks if something is equal to something else. Itโ€™s used when checking conditions and is great to use in โ€˜ifโ€™ statements It is not used for assigning values! Use it to check if a value is true or false or if two objects are the same.

Say it out loud:

โ€œIs this thing the same as that thing?โ€

๐Ÿ”น .Touched

What it means:
This runs code when something (like the player) touches the object. Touched will happen when anything touches the object, so youโ€™ll need to use โ€˜ifโ€™ and โ€˜==โ€™ to make sure the right things is touching the object.

Say it out loud:

โ€œRun this part of the code when something touches it.โ€

๐Ÿ”น .Transparency

What it means:
Controls how see-through a part is.

  • 0 = solid

  • 0.5 = half-visible

  • 1 = invisible

Say it out loud:

โ€œMake this part invisible or see-through.โ€

๐Ÿ”น .CanCollide

What it means:
If set to false, players can walk through the part.

Say it out loud:

โ€œCan I walk through this object or not?โ€

๐Ÿ› ๏ธ MINI PROJECTS

๐Ÿšช 1. Auto-Opening Door

Setup:

  • Add a large metal-looking Part and name it "Door"
    Add a red button-looking Part and name it "DoorButton"

  • Add a ClickDetector and a Script inside the DoorButton

Script:

local door = workspace.Door

function openDoor()

    print("Opening door!")

    door.Transparency = 0.5

    door.CanCollide = false

end

script.Parent.ClickDetector.MouseClick:Connect(openDoor)

๐Ÿ’€ 2. Floor Trap That Kills

Setup:

  • Add a flat black rectangle Part and name it "Trap"

  • Insert a Script inside it

Script:

function onTouch(other)

    if other and other:FindFirstChild("Humanoid") then

        print("Trap activated!")

        other.Humanoid.Health = 0

    end

end

script.Parent.Touched:Connect(onTouch)

๐Ÿง  Quiz Questions

You can only earn dad points if you can answer all of these:

  1. What does while do in a script?

  2. What does == mean?

  3. What does .Touched let us do?

  4. What happens when .Transparency is set to 1?

  5. What does .CanCollide = false do?

๐Ÿ… Parent Point Earned If:

  • Door opens with button click.

  • Trap kills the player when stepped on.

  • Your child explains all the new keywords clearly.

  • Your child passes the end-of-day quiz (can retry).