I have just come up with this script to turn on lights in a building I have made.
while true do
wait(.2)
function lights()
if game:GetService("Lighting"):GetMinutesAfterMidnight() <= 6*60 then
script.Parent.BrickColor = BrickColor.new("Cork")
script.Parent.Material = "Neon"
script.Parent.Reflectance = 0
script.Parent.Transparency = 0.2
elseif game:GetService("Lighting"):GetMinutesAfterMidnight() >= 7*60 then
script.Parent.BrickColor = BrickColor.new ("Bright bluish green")
script.parent.Material = "Glass"
script.Parent.Reflectance = 0.3
script.Parent.Transparency = 0
end
end
lights()
end
I have tried switching game:Getservice("Lighting"):GetMinutesAfterMidnight() to game.Lighting.ClockTime, but neither is working. It still works while running, but refuses to work after I spawn in my character. I'm very new to scripting so I apologize if there is an obvious fix.
I have also tried this in both normal and local scripts. The normal script at least works when running the game, the local script didn't work at all. Still the same issue.
while true do
wait(.2)
function lights()
local lighting = game:GetService("Lighting"):GetMinutesAfterMidnight()
if lighting <= 6*60 then
script.Parent.BrickColor = BrickColor.new("Cork")
script.Parent.Material = "Neon"
script.Parent.Reflectance = 0
script.Parent.Transparency = 0.2
elseif lighting >= 7*60 then
script.Parent.BrickColor = BrickColor.new ("Bright bluish green")
script.parent.Material = "Glass"
script.Parent.Reflectance = 0.3
script.Parent.Transparency = 0
end
end
lights()
end

5 comments
Are you getting any errors? Are there any other scripts affecting the lights? What kind of script are your running that program from (localscript or script)?
I am not getting any errors and that is the only script in the game at the moment. I'm running it on a script.
I just tried running it on a local script and now it doesn't work at all.
is it something with your setting. like graphics arent high enough to see. if it is this go to file settings rending and turn up the quality.
No, I have it maxed at level 21