---------------------------------
---Day/Night Script for Blocks---
---------------------------------

b = script.Parent

local oh,om = 6,10	-- Open Time (hours,minutes) DON'T TOUCH!
local ch,cm = 17,30	-- Close Time (hours, minutes) DON'T TOUCH!

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.Material = ("SmoothPlastic")
b.Color = Color3.fromRGB(255, 195, 0)
		else
b.Material = ("Neon")
b.Color = Color3.fromRGB(200, 160, 0)
		end
	elseif (ot > ct) then
		if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
b.Material = ("SmoothPlastic")
b.Color = Color3.fromRGB(255, 195, 0)
		else
b.Material = ("Neon")
b.Color = Color3.fromRGB(200, 160, 0)
		end
	end
end

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