I'm trying to make a decal shown only if all lights were turned off, otherwise its transparency should just stay 1.
local light1 = game.Workspace.BathRoomLight1.PointLight --Bathroom Checked local light2 = game.Workspace.MyBedroom.WallLight1.Lightpart.PointLight --My room Checked local light3 = game.Workspace.LightsM.Part8.PointLight -- Aunt's room Checked local light4 = game.Workspace.KitchenLight1.LightPart.PointLight --Kitchen Checked local light5 = game.Workspace.WallLightWater1.Lightpart.PointLight -- Wall Light Water Checked local light6 = game.Workspace.WallLightTv1.Lightpart.PointLight -- TV Checked local light7 = game.Workspace.WallLightPc1.Lightpart.PointLight -- PC Checked local light8 = game.Workspace.Ceilinglight1.LightPart.PointLight -- Ceiling Checked local light9 = game.Workspace.Light.LightPart.SurfaceLight -- ?? :) Checked local d = game.Workspace.Display.Decal local lights = {light1, light2, light3, light4, light5, light6, light7, light8, light9, --light1, --light2, ... } function Evaluate() for i = 1, #lights do if lights[i].Enabled == false then --we don't do shit else break end end d.Transparency = 0 --Show decal print ("You can see me now") end for i = 1, #lights do lights[i].Changed:Connect(function() Evaluate() print ("Triggered") end) end
You can change the Evaluate function to something similar to this:
local function Evaluate() local showDecal = true for i = 1, #lights do if lights[i].Enabled == true then showDecal = false break end end if showDecal then d.Transparency = 0 else d.Transparency = 1 end end