I tried what I could however I couldn’t figure out how to check if it’s past 17:45:00 but before 06:25:00. Any help appreciated! Code below
while wait(1) do
local TimeInUnix = os.time()
local Lighting = game:GetService("Lighting")
local stringToFormat = "%H:%M:%S"
local result = os.date(stringToFormat, TimeInUnix)
Lighting.TimeOfDay = result
end
local function checkTime(time, req1, req2)
if tonumber(time:split(':'))[1] >= tonumber(req1:split(':'))[1] and tonumber(time:split(':'))[2] >= tonumber(req1:split(':'))[2] and tonumber(time:split(':'))[3] >= tonumber(req1:split(':'))[3]
or
tonumber(time:split(':'))[1] =< tonumber(req2:split(':'))[1] and tonumber(time:split(':'))[2] =< tonumber(req2:split(':'))[2] and tonumber(time:split(':'))[3] =< tonumber(req2:split(':'))[3]
then
return true
else
return false
end
end
Not sure if this would work (I’m on mobile)
For you to use this function in your example:
if checkTime(result, "17:45:00", "06:25:00") then
end
while wait(1) do
local stringToFormat = "%H:%M:%S"
local result = os.date(stringToFormat,os.time()) -- Converted into H:M:S.
local splitted = string.split(result,":") -- Splitted it to get H M S separate.
local H,M,S = splitted[1],splitted[2],splitted[3] -- Assigned them to variables.
local Hour = H+(M/60)+(S/3600) -- Converted them into H only.
game.Lighting.ClockTime = Hour -- Setted the time.
end
white true do
local secondsPastToday = os.time() % 86400
if secondsPastToday < 23100 or secondsPastToday > 63900 then
print("its past 17:45 and before 06:25")
else
print("Hello World")
end
task.wait(1)
end
That’s the seconds representation of your time stamps, (P.S: did you try the function I gave you 28 days ago, this will hopefully allow you to do the thing you want for multiple numbers