Hello,i’d like to find an information how to make formattable timer giver every hour.When i click on button if it ready it will print a text in a console(“hello world”) and it will set a timer(1 hour) to get this print again!and it u click this button and a timer havent ready yet.Instead of text in button:“Get print” it will change into:"59:59,48:43,45:23) like the timer you currently need with formatted text.If in short:click to get print,start the saveable timer,format text if timer havent come yet.If ready repeat the same
(I’m not sure if I’m understanding you correctly, the lack of spaces makes this kinda hard to read)
You would probably want to be storing the latest “start time” of the timer into a datastore (so it saves), retrieving it and checking if it has been over an hour since that time whenever the button is pressed, and if so, print whatever you want while also setting the latest “start time” to be the current time.
Assuming you also want some UI to work with this, just set the UI text to be the current amount of time left (currentTime-startTime) every second using your choice of loop.
If you’re gonna handle it while the player stays in game, you wanna have a variable for the time they joined. Then everytime they click the button simply check if the time elapsed is > 1h.
local player = game.Players.LocalPlayer
local starttime = tick()
script.Parent.TextButton.MouseButton1Click:Connect(function()
if tick() - starttime >= 3600 then
— Give money
else
— I assume you know how to format
script.Parent.TextButton.Text = formattedtext
end
end)
Use a data store if you wanna handle across multiple sessions