local TweenService = game:GetService("TweenService")
local lights1 = game.Workspace.FirstLights:GetDescendants()
for index,light in pairs(lights1) do
local fade = TweenService:Create(light.Light.Value.SpotLight, TweenInfo.new(5), {Brightness = 5})
fade:Play()
end
Error is “Light is not a valid member of UnionOperation "Workspace.FirstLights.One.CClamp”
CClamp is your UnionOperation(Part), the CClamp does not have a property named “Light” nor does it have any descendants named “Light”.
So, within your for loop you would need to check to see if there is a child named “Light” using.
:FindFirstChild()
I’m not really sure why you are using a loop to iterate over things when you can just get them outright… but here is the adjusted code. Make sure you understand the logic behind it.
local TweenService = game:GetService("TweenService")
local lights1 = game.Workspace.FirstLights:GetDescendants()
for index, child in pairs(lights1) do
local light = child:FindFIrstChild("Light")
if light then
local fade = TweenService:Create(Light.Value.SpotLight, TweenInfo.new(5), {Brightness = 5})
fade:Play()
end
end