Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
v2 · Activity 2 of 4 · button-events · activated · 28 min Requires Roblox Studio
GuiButton.Activated is the cross-input activation event. It supports mouse, touch and gamepad selection activation. It is preferable here to a mouse-only assumption.
A client-side sound preference is local presentation state. Toggling it does not require granting authoritative rewards. This exercise does not play sound; off remains the default.
Make SoundButton start at Sound: off. Toggle a local soundEnabled boolean and the label with Activated. Use a readable touch-sized button.
Interface: Complete the documented Studio hierarchy and self-check the behavior outside the browser.
| Input | Expected |
|---|
button.Activated:Connect(function()
panel.Visible = not panel.Visible
end)One event supports several input methods. The action changes presentation visibility.
New syntax: button-events, activated
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/SettingsGui (ScreenGui) SoundButton (TextButton) SoundController (LocalScript)
Main guided reference implementation; use the hierarchy’s stated Script or ModuleScript type.
local button = script.Parent:WaitForChild("SoundButton")
local soundEnabled = false
button.Size = UDim2.fromOffset(200,52)
button.TextSize = 20
button.Selectable = true
local function render() button.Text = soundEnabled and "Sound: on" or "Sound: off" end
button.Activated:Connect(function() soundEnabled = not soundEnabled; render() end)
render()A GUI object covering the button can intercept input; inspect overlap and visibility.
Do not bind both mouse-only and Activated to the same toggle unless you prevent duplicate activation.
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.
GuiButton.Activated is the cross-input activation event. It supports mouse, touch and gamepad selection activation. It is preferable here to a mouse-only assumption.
A client-side sound preference is local presentation state. Toggling it does not require granting authoritative rewards. This exercise does not play sound; off remains the default.
Render the label from the current state after every toggle. The text tells users what changed, so color is not the only feedback.
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.