I want to make it so when I click on a GUI, you can toggle the "Enabled" Value on every Part in the Model's PointLight, so basically you can Turn off and on every single light in the Model.
The layout is Model>Part>PointLight
script.Parent.MouseButton1Click:connect(function()
local children = game.Workspace.Lights:GetChildren()
for i = 1, #children do
if i, children[i].PointLight.Enabled = true then
i, children[i].PointLight.Enabled = false
else
i, children[i].PointLight.Enabled = true
end
end)

3 comments
He's right, you do not need a i, in every line.
I tried it but the PointLight won't enable/disable
Nevermind, thank's for the answer.