Help With os.time() & Connecting It With Lighting

Good evening. I cannot figure this out. When it is past 18:15 but before 6:30, the lighting will still be turned off.

I’ve now tried it more and nothing is working.

while true do
    local hourShift = -4
    local timeShift = hourShift * 60 * 60

    local TimeInUnix = os.time() + timeShift

    local stringToFormat = "%H:%M"

    local result = os.date(stringToFormat, TimeInUnix)
    
    if result >= "18:15" then
        if result <= "06:30" then
            for i,v in pairs(game.Workspace.GameLighting:GetChildren()) do
                v.SurfaceLight.Enabled = true
            end
        else
            for i,v in pairs(game.Workspace.GameLighting:GetChildren()) do
                v.SurfaceLight.Enabled = false
            end
        end
    else
        for i,v in pairs(game.Workspace.GameLighting:GetChildren()) do
            v.SurfaceLight.Enabled = false
        end
    end
    wait(60)
end

Any response appreciated. Thank you so much.

To start with you are using os.time() with no perams and you cant compare (6:15) with anything as it contains a colon that is most definatly not a number. You need to choose either local time or general time as a param and remove the colons from the times.

This most definatly would have printed errors so please make at least some kind if attempt at fixing your own code before making a post. Also you are wait(60) before each check, surely you could coroutine a clock and do the time yourself rather than playing around with apis you didnt bother to read.

It doesn’t print an error though, lol. And, I don’t often use os.time() so what do you mean by parameter added to it so it can use a :