Countdown Event

Yes, like in the picture… ahh thirty ch

Alright lemme try and get this 100% correct.

  • You want to have 3 count downs at the same time
  • When one countdown is finished it goes to the bottom and stays at [ 0:00:00 ]
  • Then the other count downs just move up the line

So is like this
Just consider this is surface gui with 3 text labels and this is the text
Event A [1:00:00]
Event B [2:00:00]
Event C [3:00:00]
They gonna countdown right? all three… With their numbers too…
And after Event A finish, Event B move to the top with [1:00:00] obviously because an hour and Event C to the middle and Event A becoming on the bottom with [3:00:00]
Repeat the same process for event B, until become 0, becoming to the bottom with 3:00:00 and Event C move to the top, A in the middle
And loop

Whelp after a hour of coding and a lot of miss takes I think I finally have your solution.

Incase the video doesn’t show

YESSS, can you give the script? Thank youu

Oh yea, can this work even if no player in the server? Well just asking. But yeah what I ask the first time is like what you showed me, this question is just for a bonus question.

For your question once the server is up then the code will run.

I just need to mention this that in the line of code:

local Time
local Time2
local Time3

They need to be from the lowest to the highest a.k.a. ascending order

local h = 0
local m = 0
local s  = 0
local formula
local SBB = workspace.TimePlace.SurfaceGui
local topBuildBoard = SBB.GlobalTime
local MiddleBuildBoard = SBB.TimeLeft
local BottomBuildBoard = SBB.c

local va = topBuildBoard.Position
local vb = MiddleBuildBoard.Position
local vc = BottomBuildBoard.Position


local Time = 10	-- Time, Time2, Time3 are 5 seconds apart
local Time2 = 15
local Time3 = 30
local debounce = 1

function CountDown(number) -- gives us the number converted into time
	h = 0
	m = 0
	s = 0

	for i=1, number do

		s = s + 1

		if s == 60 then s = 0 
			m = m + 1 
		end

		if m == 60 then m = 0 
			h = h + 1 
		end

	end


end




function LooperfunctionA(Time:number, any:"function", text:string, item) -- fires a function after the loop

	local stop = os.time() + Time
	local num = 0
	local formula

	--Before the loop

	repeat

		CountDown(Time)
		Time -= 1
		formula = h.. ":".. m.. ":".. s
		item.Text  = "Event "..text.." [".. formula.. "]"


		-- if you don't want the function to play 
		-- within the loop then move it to before


		task.wait(1)


	until

	stop < os.time()
	
	debounce += 1
	if any then any(debounce) end
	
	--After the loop
	print("finished function! :D")
end

function Refresh(check)


	if check == 1 then
		
		 topBuildBoard.Position = va	--topBuildBoard.Text = "Event A "
		 MiddleBuildBoard.Position = vb	--MiddleBuildBoard.Text = "Event B "
		 BottomBuildBoard.Position = vc	--BottomBuildBoard.Text = "Event C " 
	end

	if check == 2 then

		topBuildBoard.Position = vc;  --"Event B "
		Time = math.max(Time, Time2, Time3)
		MiddleBuildBoard.Position = va --"Event C " 
		BottomBuildBoard.Position = vb --"Event A " 
	end

	if check == 3 then
		topBuildBoard.Position = vb --Text = "Event C "
		Time2 =  math.max(Time, Time2, Time3)
		MiddleBuildBoard.Position = vc --Text = "Event A "
		BottomBuildBoard.Position = va --Text = "Event B " 
		debounce = 0 -- resets it back to the beginning
	end

end


task.wait(8)

coroutine.wrap(function()
	
	while true do
		
		LooperfunctionA(Time, Refresh, "A", topBuildBoard)
	end
	
end)()


coroutine.wrap(function()

	while true do

		LooperfunctionA(Time2, Refresh, "B", MiddleBuildBoard)
	end

end)()


while true do
	
	LooperfunctionA(Time3, Refresh, "C", BottomBuildBoard)
	
end



--Output will most likely look like :
-- Event A 1:15:23
-- Event B 2:15:23
-- Event C 3:15:23

Ah so if lets say in the future i want to well u can say update or upgrade it, i need use os.time i suppose?

I already put you as a solution but this question is just for curious cause i’m a new dev.

Depends on how you want to upgrade it, but overall I only used os.time() once in the script so I’m not too sure. Might be because my brain hurt from how many times I’ve already upgraded it. :exploding_head:

Well how i want to upgrade in the future honestly is more like soo even when there’s no player it still countdown so i can like broadcast to my group and says “Event A start from 0:00 UTC and event B start at 01:00 UTC, Event C start at 02:00 UTC, and it will repeat, after Event C finish, Event A will start again at 03:00 UTC and so on continue.

Sadly I just don’t see that possible without a single server being up and running so the code can be executed. “No players, no reason for a server.”, Basically a explanation for roblox servers.