Hi all, I wanted to ask for help today, I need after pressing the button should turn off all the lights but I do not want to write a very long script, so I need help. To make it easier for me to write the script each model is called "light" in the "light" part and there are two light sources are "PointLight" and "SurfaceLight". If you can do it, I will be very grateful!
First, add an attribute to each light (or a tag with collectionservice)
local CS = game:GetService("CollectionService") local tag = "" -- whatevever the name of your attribute/tag is then do for _, v in ipairs(workspace:GetDescendants()) do if v:GetAttribute(tag) or CS:HasTag(v, tag) then --do your code end end
This only requires 1 script in serverscriptservice