Utilities 5 min read

Organize Interactive Lights with Folders and Tags

Choose between folder-based and tag-based control for lights placed throughout a Roblox build.

Try a folder for one workshop

Group a small set of lights under DisplayLights. Give the room a switch with a server controlled prompt. Walk the folder descendants and update each Light subclass from one boolean. Change the switch color and prompt label to communicate its state to nearby players.

Use tags across independent rooms

Tag Light instances with WorkshopLamp when they belong to the same control system even though they are far apart in Explorer. Read the tagged instances when the switch changes state. Listen for new tagged objects so lamps added later join the current state.

Test with multiple lamp types

Include a SurfaceLight and a PointLight. Turn the network off, then tag another light during a test. It should immediately match the other lights. Use separate tag names when adjacent rooms need their own control.

Choose a small test bank with mixed lights

Build a workshop with two PointLights and one SurfaceLight. Put a switch near the door and leave a little ambient light so the room remains navigable with the lamps turned off. Start by placing the lamp models in a folder named DisplayLights. The folder should hold the instances that belong to this switch, even if a Light object sits inside an attachment within a lamp model. Walk around the room and check what each fixture illuminates. It is easier to distinguish an effect that is disabled from a poorly aimed SurfaceLight before switching them all together. Test each lamp at full brightness once before wiring the group.

Store the group state in one place

A single boolean should represent whether the test bank is on. The prompt handler flips it and applies the new value to every Light descendant. Updating the group from one state keeps mixed lamp types synchronized even if one of them started in a different state. Give the switch a visible on color and off color, and update the label to describe the next available action. A user who enters halfway through a test should be able to tell the current state. When a switch governs the whole room, put its handler on the server so nearby players see the same lights turn on or off.

for _, instance in bank:GetDescendants() do
    if instance:IsA("Light") then
        instance.Enabled = bankOn
    end
end

Use tags when the build no longer fits one folder

In some projects a lamp is part of a larger model that should stay under another room or a piece of scenery. In that case, tag the actual Light instance instead of moving the whole model. The WorkshopLamp tag can describe the control group across the map's hierarchy. CollectionService can return the tagged objects regardless of where their models live. Check that the instance is a Light before changing Enabled. Tagging a decorative shell instead of its internal Light is a common reason for a lamp to stay unchanged during a toggle. Test one moved model before adding tags to every room.

Bring newly added lamps into the current state

At script startup, apply the current group state to the lights that already exist. Then listen for additional instances receiving the tag. When a new light joins, immediately apply the current value so it doesn't appear lit in a dark workshop. If your game removes a tag as part of replacing a fixture, decide whether the old object stays at its last setting or should revert to a default. The example uses tags for membership, so an untagged light remains outside subsequent changes. To avoid surprises, document that choice for anyone placing lights in Studio. Try adding and removing membership during a test cycle rather than only testing the initial map.

Test two switches as separate groups

Add another room with its own tag and switch. Walk between the rooms after toggling each one, and verify that the two sets of lamps remain independent. Have two players activate different switches almost together and compare what they see. If the same lamp reacts in both rooms, check whether you accidentally gave it both group tags. Test the appearance when the main lights go out and confirm that the next prompt stays readable. Consider how a new player sees each room upon arrival. The visible lamp state and switch cue should agree before anyone interacts. Finally, choose the organization that makes the build easier to maintain: one folder for a compact station, or tags for fixtures spread across models.

Related scripts