Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
v2 · Activity 3 of 4 · ui-state · rendering · 28 min Requires Roblox Studio
Store the numeric done count as data. Text such as "2 / 3" is a representation, not the source of truth for arithmetic.
One render function updates the label and the bar from done and total. This prevents the two displays from drifting apart.
Add CompleteButton, Progress and Bar/Fill. Start done=0,total=3. Clicking adds one up to 3, then render the text and fill width. Additional clicks must not exceed completion.
Interface: Complete the documented Studio hierarchy and self-check the behavior outside the browser.
| Input | Expected |
|---|
local ratio = total > 0 and done / total or 0
label.Text = tostring(done) .. " / " .. tostring(total)
fill.Size = UDim2.fromScale(ratio, 1)Both representations derive from the same state, with a zero-total guard.
New syntax: ui-state, rendering
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.
StarterGui/QuestStateGui (ScreenGui)
CompleteButton (TextButton)
Progress (TextLabel)
Bar (Frame)
Fill (Frame)
QuestState (LocalScript)Main guided reference implementation; use the hierarchy’s stated Script or ModuleScript type.
local gui = script.Parent
local button = gui:WaitForChild("CompleteButton")
local label = gui:WaitForChild("Progress")
local fill = gui:WaitForChild("Bar"):WaitForChild("Fill")
local done = 0
local total = 3
local function render()
label.Text = tostring(done) .. " / " .. tostring(total) .. " objectives"
fill.Size = UDim2.fromScale(total > 0 and done / total or 0, 1)
button.Text = done == total and "Demo complete" or "Complete demo objective"
end
button.Activated:Connect(function() done = math.min(total, done + 1); render() end)
render()Fill width is relative to Bar; verify Fill’s parent.
Do not add to done in two independent callbacks.
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.
Store the numeric done count as data. Text such as "2 / 3" is a representation, not the source of truth for arithmetic.
One render function updates the label and the bar from done and total. This prevents the two displays from drifting apart.
The button is a local interface demonstration. It does not prove real quest completion; a game should render server-confirmed objective state.
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.