Module 8 · Roblox's object model
Vector3, Color3, and CFrame fundamentals
Represent 3D measurements, color, and position-plus-rotation without advanced spatial math.
What you will learn
- Use Vector3 for size and position
- Use Color3 for color
- Explain CFrame as position plus rotation
- Vector3
- Three numeric components commonly representing a 3D position, size, or direction.
- CFrame
- A datatype representing 3D position and orientation.
Loading saved progress…
Understand
Read the idea and follow a worked example.
Why this matters
Coin Quest platforms and checkpoints need understandable size, color, position, and facing direction.
The mental model
Vector3 holds x, y, and z components. Color3 holds red, green, and blue components; fromRGB uses familiar 0-255 values.
CFrame combines position and rotation. Use PivotTo for models and PVInstances when moving complete assemblies later.
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 “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 = Instance.new("Part")platform.Name = "CoinPlatform"platform.Anchored = trueplatform.Size = Vector3.new(8, 1, 8)platform.Color = Color3.fromRGB(255, 210, 70)platform.CFrame = CFrame.new(0, 5, 0) * CFrame.Angles(0, math.rad(45), 0)platform.Parent = workspaceLine by line
- 3
A new Part is created unparented.
- 6
Vector3 describes width, height, and depth.
- 7
fromRGB builds the visible color.
- 8
The CFrame places the Part and rotates it 45 degrees around Y.
- 9
Parent is assigned after geometry is ready.
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: A new Part is created unparented.
Line 6: Vector3 describes width, height, and depth.
Line 7: fromRGB builds the visible color.
Line 8: The CFrame places the Part and rotates it 45 degrees around Y.
Line 9: Parent is assigned after geometry is ready.
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: The platform's changed measurement matches the component you intended.
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
Which Size component is the platform height?
Try it
Mark each step after you have tried it.
Common mistake
Position alone does not carry rotation. When orientation matters, use CFrame deliberately rather than treating three position numbers as a complete transform.
Checkpoint
Submit once you have considered every question. Retries are unlimited.
Recap
- Vector3 represents three-component measurements.
- Color3 represents color.
- CFrame combines position and orientation.
Next: Next, you will hide and restore a platform without losing its original state.
Studio Companion
Not connected
Connect once. Compatible challenges will prepare automatically as you reach them.