So I am having an issue with my script, and I have done all I could to solve it. What I want to do is create a function that turns on multiple lights with a simple on and off switch.
script.Parent.ClickDetector.MouseClick:connect(function()
for _,Part in pairs(workspace.Lights.CL:GetChildren()) do
if Part:FindFirstChild("SpotLight") then
Part.SpotLight.Enabled = true
end
end
end)
So this is what I've done to troubleshoot with no success:
-- I've tried to change the names of the models I used them for.
-- I've deleted the Part/Model and recreated it.
What is interesting, however:
-- It works in studio mode > Play here with other places/games.
-- It works if I paste the code and write in the name for each Part/Model (which is a waste of time).
Any help? I'm still learning to code, so any help I can get would be useful. thank you!

5 comments
That code looks fine, I'm not sure why it wouldn't work.
Do you get any errors in the output? Or did you not group the models correctly?
@iimayk I don't know what the issue is, It's just not working...
I feel like ROBLOX itself is the issue...
Bump