I tried your function and it WORKED! Thank you for your time. Maybe the loop was interfering with something I didnt know? But it worked! I’ll remember to use functions for loops!
1 Like
Yep, glad I could help! I’m still not sure why the code in your clip didn’t work, but at least we figured it out. And yeah, remember to use functions like I did if you want to change properties of multiple parts at once rather than change 1, wait a bit, change the next.
1 Like
if you want to effect both spotlights AND pointlights, you can call IsA() on their abstract class (“Light”)
local function Lights(Value)
for i,v in pairs(game.Workspace.Train1:GetDescendants()) do
if v:IsA("Light") then
v.Enabled = Value
end
end
end