Hello there!
I have made this script that is conjectured to manage generators, which will handle lights on my site, the problem is the script is client-sided and only one light turns off (instead of 3) when the generator is turned off, could I receive some help with the script?
2 Likes
local pointlights = {workspace.Lightemitter.PointLight, game.Workspace.no1.PointLight, etc:}
for i,v in pairs(pointlights) do
-- v is a pointlight
v.Enabled = false --/true
end
3 Likes
What you could do, and is probably more reliable, is set up a for loop. What you can do is something like what @Airzy_Az suggested and put
local pointlights = {
light1, light2, light3, etc.
}
for i,v in pairs(pointlights) do
if v.Name == --[[String that is specific name of light]] then
v.Color == Color3.fromRGB(RGB color value here)
v.Enabled = not v.Enabled --Simple toggle that will set off if on, and vise versa
elseif v.Name == --[[Other light(s) that you want to have different color]] then
--Same as above, set color with Color3
v.Enabled = not v.Enabled
end
v.Enabled = false --/true
end
3 Likes