I'm making a live event and added a countdown so players know when it will start, But when I tested it, there were 0 days left but it says 1 day left, Can anyone help me?
Here's my code
local timeToStart = 1621196661
local timeToStop = 1621197661
function liveEvent()
game.Lighting.TimeOfDay = 0
end
while wait(1) do
local currentTime = os.time()
if currentTime >= timeToStop then
break
end
if currentTime >= timeToStart then
print("Start the event")
liveEvent()
break
else
print(timeToStart - currentTime.." seconds left until the live event!")
local day = os.date("*t", timeToStart - currentTime)["day"]
local hours = os.date("*t", timeToStart - currentTime)["hour"]
local mins = os.date("*t", timeToStart - currentTime)["min"]
local seconds = os.date("*t", timeToStart - currentTime)["sec"]
local stringToFormat = day..":"..hours..":"..mins..":"..seconds
local result = os.date(stringToFormat, day, hours, mins, seconds)
workspace:FindFirstChild("LiveEventCountdown"):FindFirstChild("SurfaceGui"):FindFirstChild("TextLabel").Text = result
end
end
