Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Clicking Gui Disables PointLight?

Asked by 10 years ago

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)

1 answer

Log in to vote
5
Answered by
Discern 1007 Moderation Voter
10 years ago

In every one of the i, children[i], just remove the i,and you're good to go.

So in other words, i, children[i] should look like children[i] in all the lines.

1
He's right, you do not need a i, in every line. M39a9am3R 3210 — 10y
0
I tried it but the PointLight won't enable/disable ScriptingHelpersALT 20 — 10y
0
Nevermind, thank's for the answer. ScriptingHelpersALT 20 — 10y
Ad

Answer this question