Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get resettimer to sync with TextLabel?

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

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.

0
He has it in minutes not seconds.. This wouldn't work Kingu_Criminal 205 — 1y
Ad
Log in to vote
0
Answered by 1 year ago
Edited 1 year ago
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

Answer this question