local light = script.Parent
local timeofday = game.Lighting.TimeOfDay

while true do
	wait(1)
	if timeofday > "17:45:00" and timeofday < "06:20:00" then
		print("its night")
		light.Angle = 180
		light.Brightness = 10
		light.Range = 12
	else
		print("its day")
		light.Angle = 0
		light.Brightness = 0
		light.Range = 0
	end
end

The output keeps on printing that it's day..

I don't get how to fix it. is it because of comparing with strings instead of numbers? And if it is, how would i convert time of day to numbers? It doesn't let me write the time of day as a number without an error.

2 comments

1

You can convert it to a number with GetMinutesAfterMidnight. http://wiki.roblox.com/index.php?title=API:Class/Lighting/GetMinutesAfterMidnight

0

Thanks XAXA! That helped, and now my script works