I made a script that displays the seconds left before a tram departs but after that countdown ends, I want the script to display the seconds remaining before the tram returns and I would like it to repeat the countdowns forever.
I’ll give you a short example of what a script like that would look like.
ex:
-- feel free to customize the variables at your will
local depart_time = 10
local return_time = 20
local text_label -- insert text label for num
while wait(1) do
if depart_time > 0 then
depart_time = depart_time - 1
text_label = tostring(depart_time)
elseif return_time > 0 then
return_time = return_time - 1
text_label = tostring(return_time)
else
depart_time = 10
return_time = 20
text_label = tostring(depart_time)
end
end
-- feel free to customize the variables at your will
local depart_time = 10
local return_time = 20
local text_label -- insert text label for num
while wait(1) do
if depart_time > 0 then
depart_time = depart_time - 1
text_label.Text = tostring(depart_time)
elseif return_time > 0 then
return_time = return_time - 1
text_label.Text = tostring(return_time)
else
depart_time = 10
return_time = 20
text_label.Text = tostring(depart_time)
end
end
local Seconds = 30
while task.wait() do
for i = 1,Seconds do
Seconds = Seconds - 1
script.Parent.SurfaceGui.TextLabel.Text = Seconds
if Seconds < 11 then
end
wait(1)
end
end
you can use this i think, also you can write true instead of task.wait(), but i wrote task.wait because i am allergic to while true do
What do you mean “two different timers” ?
Do you mean
Two timers that works differently each other?
If that is right, you can add a wait(seconds) before the while loop. so it delays the timer starting.