Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
v2 · Activity 1 of 4 · persistent-state · temporary-state · schema · 28 min Requires Roblox Studio
A durable record might contain completed objective IDs and a preference. A current tween, open panel, connection, or character reference belongs to the current session.
Define a versioned data shape using plain serializable values. This lab builds a record; it does not write to a datastore yet.
Create SaveShape.build(state) that returns version=1, a copied completed sequence, and soundEnabled preserving false. Omit panelOpen, activeTween and character. Missing sound defaults to false.
Interface: Complete the documented Studio hierarchy and self-check the behavior outside the browser.
| Input | Expected |
|---|
local save = { version = 1, completed = {"lamp"}, soundEnabled = false }
local temporary = { panelOpen = true, activeTween = nil }The durable record contains a version and meaningful values. Interface visibility belongs to the temporary state.
New syntax: persistent-state, temporary-state, schema
Your explanation is a self-check. Exact wording is not automatically graded.
Self-checked Studio exercise. A saved checklist records your own review; no uploaded place file or screenshot is executed here.
ServerScriptService/SaveShape (ModuleScript) ServerScriptService/TestSaveShape (Script, RunContext=Server)
Module selects minimal durable fields.
local SaveShape = {}
function SaveShape.build(state)
local soundEnabled = false
if type(state.soundEnabled) == "boolean" then soundEnabled = state.soundEnabled end
return { version = 1, completed = table.clone(state.completed or {}), soundEnabled = soundEnabled }
end
return SaveShapeControlled local assertions test the schema without any datastore access.
local SaveShape = require(script.Parent.SaveShape)
local state = { completed = {"lamp"}, soundEnabled = false, panelOpen = true }
local save = SaveShape.build(state)
assert(save.version == 1 and save.soundEnabled == false)
assert(save.panelOpen == nil and save.completed ~= state.completed)
print("Save shape checks passed")A shallow clone is sufficient only because completed contains string IDs here.
Do not put engine Instances or connection objects into the save record.
This is a bounded learning lab. It has not been executed in an approved Roblox Studio environment by this website.
A checked checklist records your own review, not automated project competence or a community verification.
A durable record might contain completed objective IDs and a preference. A current tween, open panel, connection, or character reference belongs to the current session.
Define a versioned data shape using plain serializable values. This lab builds a record; it does not write to a datastore yet.
Default progress is private on this website. In your own Roblox project, decide which minimal fields need persistence and avoid saving credentials, Instances or connection objects.
Replace this code with the starter? Download your draft to keep a copy.
Edit and run these files in Roblox Studio. This browser has no Roblox services, physics, or replication.
Your output will appear here.
Sign in with RoCreators to save private progress across devices. Community verification is separate.