0 views0 copies0 likes
Tag-Based Lighting Switch for Large Builds
Universal script
Copy it, then test it in your own Studio place.
Script code
14 lines ยท 0.6 KBlocal CollectionService = game:GetService("CollectionService")local tag = "WorkshopLamp"local prompt = Instance.new("ProximityPrompt", workspace:WaitForChild("MasterLightSwitch"))prompt.ActionText = "Toggle workshop lights"local enabled = truelocal function update(instance) if instance:IsA("Light") then instance.Enabled = enabled endendCollectionService:GetInstanceAddedSignal(tag):Connect(update)prompt.Triggered:Connect(function() enabled = not enabled for _, instance in CollectionService:GetTagged(tag) do update(instance) endend)for _, instance in CollectionService:GetTagged(tag) do update(instance) endAbout this script
Tag individual Light instances with WorkshopLamp and add a part called MasterLightSwitch. The server toggles every tagged light and applies the current state when a new light receives the tag. This works across unrelated models, so you can move lamps without editing paths. Use Studio's tag tools to add a lamp during a playtest and confirm that it matches the switch.
Log in to leave a comment.
No comments yet
Be the first to share your thoughts!
Comments
Share what works, ask questions, or report an issue.