I’m trying to make a neon sign effect; so, flickering lights randomly, that sort of thing. It’s too many lights to have a script for each one.
I, v, in pairs, while it does in the end affect each of the lights, does it in a row. I’m looking for all the lights to go off at once, and then reoccur together.
The script below works, and it’s short and simple. It just makes all the lights turn off and on in a row; which isn’t what I’m looking for.
while true do
for i, v in ipairs(game.Workspace.FlickeringLights:GetChildren()) do
if v.Name == "Light" then
v.Material = Enum.Material.CorrodedMetal
wait(math.random(4,10)/10)
v.Material = Enum.Material.Neon
wait(math.random(4,10)/10)
end
end
end
while true do
for i, v in ipairs(game.Workspace.FlickeringLights:GetChildren()) do
if v.Name == "Light" then
v.Material = Enum.Material.CorrodedMetal
end
end
wait(math.random(4,10)/10)
for i, v in ipairs(game.Workspace.FlickeringLights:GetChildren()) do
if v.Name == "Light" then
v.Material = Enum.Material.Neon
end
end
wait(math.random(4,10)/10)
end
You could put this script inside ReplicatedStorage and do something like this to clone that script into every light without having to manually insert it into every light, that’s pretty much one of the only options you have here.
for i, v (workspace.FlickeringLights:GetChildren()) do
game.ReplicatedStorage.FlickerScript:Clone().Parent = v
end