I don’t know how to get the children of each part, its a bit hard to explain but I’ll just show you a screenshot.
So basically I’m trying to get all the point lights in the folder and I have no idea how. Maybe use a table or idk.
Here is the code:
local clickDetector = script.Parent.ClickDetector local lights = game.Workspace.Lights["Ceiling Light"]:GetDescendants() --This line isnt usefull at all local DEBOUNCE = false local lightsOn = false clickDetector.MouseClick:Connect(function() if not DEBOUNCE then DEBOUNCE = true if not lightsOn then lightsOn = true for i, v in pairs(lights) do v.Enabled = true end else for i, v in pairs(lights) do v.Enabled = false end lightsOn = false end DEBOUNCE = false end end)
EDIT: I could just use a bunch of lines of code but I’d rather make the code efficient ya know?