Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get resettimer to sync with TextLabel?

I have a chest that rewards money and resets every 20 minutes and I would like a timer above (I already have a BillboardGui with a TextLabel in it and script in the TextLabel) I'm not sure how to have the respawn timer sync to the TextLabel when the respawn timer starts.

2 answers

Wait, are you just asking for the value of the respawn timer to go to the text label? If so, make a loop, search up how to do that and do something as simple as

local Timer = 20
Loop here
Timer = Timer - 1
script.Parent.Text = Timer
Wait(1)
end

Add an if statement for as long as it isnt equal to 0 repeat. if its equal to 0, Timer = 20 or put it on hold however you want to.

1 comment

0

He has it in minutes not seconds.. This wouldn't work

local function toMS(s)
	return ("%i:%.2i"):format(s/60%60,s%60)
end

local minutes = 20
local seconds = minutes * 60
local textlabel = --path to billboard textlabel


while task.wait(1) do
	textlabel.Text = toMS(seconds)
	seconds -= 1
	if seconds = 0 then
		seconds = minutes * 60
		print("Finished!")
		task.wait(5)
	end
end

What the function does is it returns a formatted version, so 20 mins will be 20:00 and 5 mins will be 5:00

This discussion is preserved as it was. New answers, comments, and votes are closed.