This is my glass window script, it searches for all the parts called NeonWindow and then turns it from glass to Neon material at 19:00:00, and then Neon to glass at 07:00:00. Not ever NeonWindow part does this...I'm assuming this is because I'm not searching through all the descendants.
How would I do this, and if my assumption is wrong what else should I do instead.
while wait() do
if game.Lighting.TimeOfDay > "19:00:00" then
for _, glass in pairs (game.Workspace:GetChildren()) do
if glass.Name == "NeonWindow" then
glass.Material = 288
elseif glass.Name ~= "NeonWindow" then
for _, glass2 in pairs (glass:GetChildren()) do
if glass2.Name == "NeonWindow" then
glass2.Material = 288
end
end
end
end
elseif game.Lighting.TimeOfDay "07:00:00" then
for _, glass in pairs (game.Workspace:GetChildren()) do
if glass.Name == "NeonWindow" then
glass.Material = 1536
elseif glass.Name ~= "NeonWindow" then
for _, glass2 in pairs (glass:GetChildren()) do
if glass2.Name == "NeonWindow" then
glass2.Material = 1536
end
end
end
end
end
end
