local y=18 local u=7.5 function event1()Light.Enabled=true LightSource.Material="\078\101\111\110"end function event2()Light.Enabled=false LightSource.Material="\083\109\111\111\116\104\080\108\097\115\116\105\099"end function onChanged()if u<=y then if l:GetMinutesAfterMidnight()>=toMinutes(y)or l:GetMinutesAfterMidnight()<=toMinutes(u)then event1()else event2()end elseif u>=y then if l:GetMinutesAfterMidnight()>=toMinutes(y)and l:GetMinutesAfterMidnight()<=toMinutes(u)then event1()else event2()end end end l.Changed:connect(onChanged)
--This uses a 24 hour format.
--This example uses 18:00 to 7:30, or 6 PM to 7:30 AM

local time1 = 18 --18:00, or 6:00 PM
local time2 = 7.5 --07:30, or 7:30 AM

function event1() --Event when the time is within your designated time.
	Light.Enabled = true
	LightSource.Material = "Neon"
end

function event2() --Event when the time is outside your designated time.
	Light.Enabled = false
	LightSource.Material = "SmoothPlastic"
end

function onChanged()
	if time2 <= time1 then
		if l:GetMinutesAfterMidnight() >= toMinutes(time1) or l:GetMinutesAfterMidnight() <= toMinutes(time2) then
			event1()
		else
			event2()
		end
	elseif time2 >= time1 then
		if l:GetMinutesAfterMidnight() >= toMinutes(time1) and l:GetMinutesAfterMidnight() <= toMinutes(time2) then
			event1()
		else
			event2()
		end
	end
end

l.Changed:connect(onChanged)
