b=script.Parent c=script.Parent.Parent.Parent local d,y=6,20 local I,t=17,45 local Z=game:service("\076\105\103\104\116\105\110\103")if y==nil then y=0 end if t==nil then t=0 end function TimeChanged()local a=(d+y/60)*60 local X=(I+t/60)*60 if a<X then if Z:GetMinutesAfterMidnight()>=a and Z:GetMinutesAfterMidnight()<=X then b.Enabled=false c.RearLight1.Material="\083\109\111\111\116\104\080\108\097\115\116\105\099"else b.Enabled=true c.RearLight1.Material="\078\101\111\110"end elseif a>X then if Z:GetMinutesAfterMidnight()>=a or Z:GetMinutesAfterMidnight()<=X then b.Enabled=false c.RearLight1.Material="\083\109\111\111\116\104\080\108\097\115\116\105\099"else b.Enabled=true c.RearLight1.Material="\078\101\111\110"end end end TimeChanged()game.Lighting.Changed:connect(function(d)if d=="\084\105\109\101\079\102\068\097\121"then TimeChanged()end end)
--This script turns the light on at night and off in in the day!

b = script.Parent
c = script.Parent.Parent.Parent

local oh, om = 6, 20 -- Open Time (hours,minutes)
local ch, cm = 17, 45 -- Close Time (hours, minutes)

local l = game:service("Lighting")
if om == nil then
	om = 0
end
if cm == nil then
	cm = 0
end

function TimeChanged()
	local ot = (oh + (om / 60)) * 60
	local ct = (ch + (cm / 60)) * 60
	if ot < ct then
		if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
			b.Enabled = false
			c.RearLight1.Material = "SmoothPlastic"
		else
			b.Enabled = true
			c.RearLight1.Material = "Neon"
		end
	elseif ot > ct then
		if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
			b.Enabled = false
			c.RearLight1.Material = "SmoothPlastic"
		else
			b.Enabled = true
			c.RearLight1.Material = "Neon"
		end
	end
end

TimeChanged()
game.Lighting.Changed:connect(function(property)
	if property == "TimeOfDay" then
		TimeChanged()
	end
end)
