Multiple lights, how do i get all of the lights in a script

hello everyone, i need some help on how to select multiple lights in one script

The lights I need help with

at a certain point in a game, i want these to flicker and i don’t “know” how to, well i know how to make one light flicker, but these are multiple lights and i need help figuring out how to get them all at once

i am a beginner to making games practically

1 Like

so first of all group those lights now do this

local lights = -- path to lights
for index,light in pairs(lights:GetChildren()) do
-- do what u want to do here e.g light.Anchored = false e.t.c

all the lights are in individual light models

then model all of them again duhhh

local function toggleLights(bool)
	for _, model in ipairs(workspace:GetChildren()) do
		if model:IsA("Model") then
			if model.Name == "Model" then --Change this to the models' names.
				for _, light in ipairs(model:GetDescendants()) do
					if light:IsA("Light") then
						light.Enabled = bool

Here’s a short function that you can use to toggle all of the lights on and off.

Try putting all the light models into 1 group then try something like this

for i,v in pairs(GroupOfLightModels:GetDescendents()) do
    if v == "Light" then
    --do something with the light