Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
React to a prompt event
v2 · Activity 1 of 0 · events · connections · 28 min Requires Roblox Studio
Chapter outline
An event announces something that happened. prompt.Triggered:Connect(callback) registers a callback; it does not immediately call that callback.
Triggered supplies the Player who used the prompt. Use that parameter rather than guessing which player interacted.
Your task
Put a ProximityPrompt inside WorkshopLamp. Connect once on the server and print Lamp requested followed by the triggering player’s name.
Interface: Complete the documented Studio hierarchy and self-check the behavior outside the browser.
| Input | Expected |
|---|
Syntax in this activity
New syntax: events, connections
Earlier ideas used here
- client-server
- replication
- authority
Self-check rubric
- The prompt appears when the character is near the Part.
- Each deliberate activation produces one diagnostic line.
- Walk away and verify the normal prompt UI no longer offers the action.
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.
Build this hierarchy
Workspace/WorkshopLamp (anchored Part) ProximityPrompt ServerScriptService/PromptLog (Script, RunContext=Server)
- Create an anchored Part named WorkshopLamp near the spawn.
- Insert ProximityPrompt; set ActionText Inspect, ObjectText Workshop lamp, MaxActivationDistance 10, HoldDuration 0.
- Insert PromptLog in ServerScriptService.
ServerScriptService/PromptLog.server.luau
Main guided reference implementation; use the hierarchy’s stated Script or ModuleScript type.
local lamp = game:GetService("Workspace"):WaitForChild("WorkshopLamp")
local prompt = lamp:WaitForChild("ProximityPrompt")
prompt.Triggered:Connect(function(player)
print("Lamp requested", player.Name)
end)Expected output
- Using the prompt prints Lamp requested and your player name on the server.
Studio assessment checklist
Multiplayer tests
- Two clients activate the prompt and the server logs the correct triggering names.
Troubleshooting and production considerations
A missing prompt usually means the hierarchy or name differs.
Duplicate lines often mean duplicate connections or duplicate scripts.
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.
Put a ProximityPrompt inside WorkshopLamp. Connect once on the server and print Lamp requested followed by the triggering player’s name.
Reset starter
Replace this code with the starter? Download your draft to keep a copy.
Code
Studio source fileEdit 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.