Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Clicking Gui Disables PointLight?

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

✓ Accepted answer

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.

3 comments

1

He's right, you do not need a i, in every line.

0

I tried it but the PointLight won't enable/disable

0

Nevermind, thank's for the answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.