Countdown Event [HELP]

How to make countdown that trigger everyday but on specific time like 10 UTC and 15 UTC everyday, so there is no specific date, i want it like happen everyday. Also there’s a surface gui that shows how many hours or minutes or seconds into that event

I had to re read the os docs → os
basically you can do this though:

local UTC_time = os.date("!*t")
--you can get the time like this:
print(UTC_time.hour .. ":" .. UTC_time.min .. ":" .. UTC_time.sec)

see os docs for other things you can get from os

I hope this works!

1 Like

But can we make it like happens everyday? because I saw many tutorials , all using specific date and they find the unixcode (CMIIW) of that date.

perhaps looking up tutorials on a daily reward system may help you, as what you seem to be describing is basically a daily reward

Look into DateTime. You can use this library to conveniently format and derive timestamps.

using fromUniversalTime? I still don’t know.

Apologies for the late reply. This is simple.

local function countdown(utc)
	local goal = 15 -- utc hour
	local currSec = (utc.hour*3600)+(utc.min*60)+utc.sec
	local secLeft = 0
	if utc.hour<goal then
		local gSec = goal*3600
		secLeft = gSec-currSec
	else
		local gSec = (goal*3600)+(86400-currSec)
		secLeft = gSec
	end
	local hr = math.floor(secLeft/3600)
	local min = math.floor((secLeft-hr*3600)/60)
	local sec = secLeft%60
	return string.format("%02d:%02d:%02d", hr, min, sec)
end

countdown(os.date("!*t") --> 10:22:54 (hh:mm:ss)

So i suppose i can make it to label like label.Text = countdown(os.date(”!*t”))

Yes. Let me know if you want the format to be different.

Well honestly I just want to make like a surface gui on a part, that has 3 events, that countdown to three specific time and when the first even finish, it will remove the label and the next event will be on top, and the bottom one move to the middle and make a new event with the time like the first one and put the label as the bottom, well i can use UIList or UIGrid for making it to the top and middle and bottom, but can i make it like if its already reach goals it will remove the label and make new label with same time, but for the next day?