To unlock a light with a press button in Roblox, put a light object inside the lamp part, add a ClickDetector to the button part, and use a script to toggle the light’s Enabled property when the button is clicked.

Simple setup

  1. Create the light part and insert a PointLight or SurfaceLight into it.
  1. Create the button part and add a ClickDetector to it.
  1. Add a Script inside the button and connect the click event to turn the light on or off.

Example script

lua

local button = script.Parent
local clickDetector = button:WaitForChild("ClickDetector")
local lightPart = workspace:WaitForChild("LightPart")
local light = lightPart:WaitForChild("PointLight")

light.Enabled = false

clickDetector.MouseClick:Connect(function()
	light.Enabled = not light.Enabled
end)

This version makes the light toggle every time the button is pressed, which is usually the cleanest way to “unlock” a light in a Roblox build.

If it does not work

  • Check that the part names match exactly.
  • Make sure the light is actually inside the target part, not just somewhere else in Workspace.
  • Confirm the button has a ClickDetector and the script is inside the button.

Optional behavior

If you want the button to act like a one-time unlock, you can replace the toggle with light.Enabled = true so it stays on after the first click. If you want, I can also write a version that unlocks the light for 3 seconds or changes the button color when pressed.