Hello, I would like to know how I could get the children of a GetChildren()
In my game, I have a model that contains parts containing pointlights. What I would like to do is set PointLight.Enabled to false using a for loop, however I am unsure how I would reference all of these pointlights?
Here is my current script:
(The model containing the parts that contain pointlights is "Model" - top line)
local parts = game.Workspace.Model:GetChildren()
local power = game.Workspace.Value
while true do
wait(1)
if power.Value > 0 then
power.Value = power.Value - 1
if power.Value == 0 then
for i, v in pairs(parts) do
v.Material = Enum.Material.SmoothPlastic
end
else
for i, v in pairs(parts) do
v.Material = Enum.Material.Neon
end
end
end
end

1 comment
https://developer.roblox.com/en-us/api-reference/function/Instance/GetChildren