LightsOn=script.Parent.LightsOn
local tweenInfo = TweenInfo.new(5)
local TweenService = game:GetService("TweenService")
local Rooflights = {}
local function FindRoofLights(obj)
for _, child in pairs(obj:GetChildren()) do
if child:IsA("Light") then
table.insert(Rooflights, child)
end
FindRoofLights(child)
end
end
FindRoofLights(script.Parent.Lights.BlueRoofLights)
local function OnClick()
for _, light in pairs(Rooflights) do
local TweenValue =
{
Brightness = 9.84;
}
local tween = TweenService:Create(light, tweenInfo, TweenValue)
tween:Play()
end
end
LightsOn.ClickDetector.MouseClick:connect(OnClick)
you need set the starting color to the current light color and the ending color to a desired brightness level (full brightness in this example).
Please note that this method will only work for PointLights, SpotLights, and SurfaceLights. If you’re trying to tween other types of lights, additional modifications might be required.
Feel free to adjust the tween duration (tweenInfo.new(5)) and the endingColor values (Color3.new(1, 1, 1)) according to your preferences and requirements.
I think this should work if not then i dont know. feel free to correct me if im wrong
local TweenService = game:GetService("TweenService")
local Rooflights = {}
local function FindRoofLights(obj)
for _, child in pairs(obj:GetDescendants()) do
if child:IsA("Light") then
table.insert(Rooflights, child)
end
end
end
FindRoofLights(script.Parent.Lights.BlueRoofLights)
local function OnClick()
for _, light in pairs(Rooflights) do
local startingColor = light.Color
local endingColor = Color3.new(1, 1, 1) -- Adjust the brightness by modifying the RGB values (1, 1, 1 = full brightness)
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(light, tweenInfo, {Color = endingColor})
tween:Play()
end
end
script.Parent.LightsOn.ClickDetector.MouseClick:Connect(OnClick)