Module 8 · Roblox's object model
Mini-project: A disappearing platform
Hide a marked Part, disable collision, and restore its original state safely.
What you will learn
- Configure the platform hierarchy
- Preserve and restore visible and collision state
- Use a guided observation honestly
- collision
- Whether a physical object can block other physical objects.
- restore
- Return state to its prior values.
Loading saved progress…
Understand
Read the idea and follow a worked example.
Why this matters
A disappearing platform makes Coin Quest's world respond over time while reinforcing ownership, hierarchy, and property state.
The mental model
The marked Part owns one child server Script. The script remembers original Transparency and CanCollide values before changing them.
The structure can be checked automatically; whether the timed experience feels right is a guided observation, not a fabricated automated pass.
New words and symbols
--!strict asks Studio to check your code for type mistakes. It is an instruction for the editor and produces no Output message.
Matching quotes such as "hello" surround a string: a piece of text. The quotation marks tell Luau where the text starts and ends.
local is read as “local”: it creates a name that is available only in the current code scope.
: is read as “colon”: it calls a method with the object supplied as the first receiver value.
= is read as “is assigned”: it evaluates the right side and stores that value in the name on the left.
. is read as “dot”: it accesses a named property or table field.
A tiny example
--!strictlocal platform = script.Parentassert(platform:IsA("BasePart"), "PlatformController must be under a BasePart")local originalTransparency = platform.Transparencylocal originalCanCollide = platform.CanCollideplatform.Transparency = 1platform.CanCollide = falsetask.wait(2)platform.Transparency = originalTransparencyplatform.CanCollide = originalCanCollideLine by line
- 3
The child Script reads its parent target.
- 4
The assertion documents and checks the expected class.
- 6
Original visibility is preserved.
- 7
Original collision state is preserved separately.
- 9
Transparency 1 hides the Part.
- 10
Collision is disabled while hidden.
- 11
The thread yields for a short interval.
- 12
The exact prior visibility returns.
- 13
The exact prior collision state returns.
Read the code aloud
Read one statement at a time: name the value being read, what the operation does, and where its result goes. Keep identifiers exactly as written so you can find them again in the code.
Pause at calls, conditions, and loops. Explain when the body runs before moving to the next statement; use the line notes above when a symbol is unfamiliar.
Execution trace
Begin at the first executable statement. Comments and blank lines do not run; a branch chooses which block runs, and a loop may revisit its body.
Line 3: The child Script reads its parent target.
Line 4: The assertion documents and checks the expected class.
Line 6: Original visibility is preserved.
Line 7: Original collision state is preserved separately.
Line 9: Transparency 1 hides the Part.
Line 10: Collision is disabled while hidden.
Line 11: The thread yields for a short interval.
Line 12: The exact prior visibility returns.
Line 13: The exact prior collision state returns.
State before and after
Before running, identify the starting values and any existing Studio objects this example needs. List what you expect to change.
After your practice change, check this result: Structure checks pass and your observation confirms the Part returns to its own original state.
Reading or printing a value leaves it unchanged. Look for assignments, calls that change state, and property updates to explain each change you observe.
Predict before running
Why store originalCanCollide?
Try it
Mark each step after you have tried it.
Common mistake
Restoring hardcoded defaults can overwrite a learner's intentional setup. Capture original values before the temporary change.
Checkpoint
Submit once you have considered every question. Retries are unlimited.
Recap
- Hierarchy gives a script a focused target.
- Temporary changes should restore captured state.
- Manual observations must be labeled honestly.
Next: Module 9 responds to events and cleans up scheduled work and connections.
Studio challenge
A disappearing platform
Checks are formative feedback, not cheat-proof certification. You can finish this lesson without the plugin.
- Target
- Workspace/LearningLuau/DisappearingPlatform
- Check mode
- instance structure
Challenge state: idle
Studio Companion
Not connected
Connect once. Compatible challenges will prepare automatically as you reach them.