I am trying to make a script that turns a lamp on when the time is past 19:00:00. It works fine till 23:00:00 but then the time reaches 0 so then the lights are turned off even though it is still night. Can you tell me how can I possible fix this?

local lights = script.Parent.Bulb:GetChildren()
local lighting = game.Lighting

while true do
	wait(0.5)
	if lighting.ClockTime < 19 then
		for i,v in ipairs(lights) do
			v.Range = 0
		end
	elseif lighting.ClockTime > 19 then
		for i,v in ipairs(lights) do
			v.Range = 60
		end
	end
end

3 comments

0

use :GetMinutesAfterMidnight()

0

I don't know how

0

bcz u have to do => or >= pretty sure