What is the absolute easiest way

To make a grouped set of light parts randomly turn on and off without adding a script into each individual light and without looping patterns.

I suppose you have to be online 24 hrs a day with F3X changing the light brightness.

Seriously tho, I am pretty sure you can’t do this in any other way.


why wouldn’t there be a way, it just makes it less chunky and only requires one script for example the elevator light flickers while the other remain the same and a few seconds later the elevator light is fine but one of the above ones flickers.


local ModelWithLights = [YourModelWithLightsHere]

local minWaitTime = [YourMinDelay]
local maxWaitTime = [YourMaxDelay]

while true do
  wait(math.random(minWaitTime, maxWaitTime))

  local randomLight = math.random(1,#ModelWithLight:GetChildren())
  local LightObject = ModelWithLight:GetChildren(randomLight):FindFirstChildOfClass("SpotLight") -- Change "SpotLight" to "PointsLight" or whatever the light is named.

  for i=1, math.random(3,5) do
     LightObject.Enabled = false
     wait(math.random(0.1,0.5))
     LightObject.Enabled = true
  end
end

Of course, you have to make sure that the model with all the lights only contains the light models. And each LightModel needs to have only one Light Emmiter.

1 Like

Thanks for the help but i should have also added i’m trying to avoid while true loops

Why do you want to avoid them? They can be quite practical.

Edit: If you want them to not yield your entire script I suggest you use coroutines.

https://developer.roblox.com/en-us/api-reference/class/CollectionService

You’ll still need to make use of a for construct (looping pattern) unless you want code that looks like the following.

light1.Enabled = false
light2.Enabled = false
light3.Enabled = false
...
1 Like

They can cause lag I’m pretty sure they can interfere with the server .