I think i have an idea on how to do it but not sure.
so what i want to do is when the red button is press all the lights in the group will turn red and flash and then after 45 second it will go back to normal
Make a function that gets all the children of the group, checks if they’re a pointlight, if they are then it changes the pointlight’s color to the function’s parameter.
Then just do something like runFunction(Red) wait(45) runFunction(white)
local Lights = workspace.Lights:GetDescendants()
local ClickDetector = script.Parent
local Buf = {}
for ObjIndex = 1, #Lights do
if Lights[ObjIndex]:IsA("Light") then
table.insert(Buf, {Lights[ObjIndex], Lights[ObjIndex].Color})
end
end
Lights = Buf
Buf = nil
local Running = false
ClickDetector.MouseClick:Connect(function()
if Running then return end
Running = true
for LightIndex = 1, #Lights do
Lights[LightIndex][1].Color = Color3.fromRGB(255, 0, 0)
end
for i = 1, 90 do
for LightIndex = 1, #Lights do
Lights[LightIndex][1].Enabled = true
end
wait(.25)
for LightIndex = 1, #Lights do
Lights[LightIndex][1].Enabled = false
end
wait(.25)
end
for LightIndex = 1, #Lights do
Lights[LightIndex][1].Color = Lights[LightIndex][2]
end
Running = false
end)