-- Variables local ActivationLights = game.Workspace.ActivationLights local DarklightDoor = script.Parent local function updateDoor() local isAllNeon = true for _,light in pairs(ActivationLights:GetChildren()) do if light.Material ~= Enum.Material.Neon then isAllNeon = false break end end if isAllNeon then DarklightDoor.Transparency = 1 DarklightDoor.CanCollide = false else end end for _,light in pairs(ActivationLights:GetChildren()) do light:GetPropertyChangedSignal("Material"):Connect(updateDoor) end
Anyways, here is an example of what I'm trying to do. I want the door to become transparent and CanCollide = false when ErnestaLight, DanLight, AquiziviteLIght, LovelyLight, and QuinnKennithLight are neon/activated. Please help! (For a myth game) Before you ask, nothing is underlined, nothing comes out in the output.
--variables for your lights and door here local lights = {light1, light2, light3, light4, light5,} local function Evaluate() local doorOpen = true for i = 1, #lights do if not lights[i].Material == Enum.Material.Neon then doorOpen = false break end end if doorOpen then YourDoor.Cancollide = false YourDoor.Transparency = .5 -- or whatever you prefer else YourDoor.CanCollide = true YourDoor.Tansparency = 0 end end for i = 1, #lights do lights[i].Changed:Connect(function() Evaluate() print ("Triggered") -- this was a test, delete it if you like end) end
--variables for your lights and door here
local lights = {game.Workspace.DarklightDoor.AquiziviteLight, game.Workspace.DarklightDoor.DanLight, game.Workspace.DarklightDoor.ErnestaLight, game.Workspace.DarklightDoor.LovelyLight, game.Workspace.DarklightDoor.QuinnKennithLight} local YourDoor = game.Workspace.DarklightDoor
local function Evaluate() local doorOpen = true for i = 1, #lights do if not lights[i].Material == Enum.Material.Neon then doorOpen = false break end end
if doorOpen then YourDoor.CanCollide = false YourDoor.Transparency = 1 -- or whatever you prefer end
end
for i = 1, #lights do lights[i].Changed:Connect(function() Evaluate() print ("Triggered") -- this was a test, delete it if you like end) end
I changed it to this, why isn't it working?