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

how to make a timer on a textLabel?

how to make a timer on a textLabel? I tried to make a script but it would work only for small numbers and not large, so it is not productive. script:

local texttlabel = script.Parent.Parent.PlayerGui.TextLabel
function touch ()
	texttlabel.Text = '3'
	wait(1)
	texttlabel.Text = '2'
	wait(1)
	texttlabel.Text = '1'
	wait(1)
	texttlabel.Text = ''
end
game.Workspace.Part.Touched:Connect(touch)

I wanted to make a 3 minute timer, but I don't know how to do it quickly

1 answer

✓ Accepted answer

You can use for loops to solve this, using for loops you can treat each iteration as a second and wait a second, making it act just like a timer. Using the third increment value, you can further ease your job.

local timerNotOn = true
local texttlabel = script.Parent.Parent.PlayerGui.TextLabel

local function touch ()
    if timerNotOn then
        timerNotOn = false
        for seconds = 3*60, 0, -1 -- 3 minutes = 3*60 seconds 
            texttlabel.Text = seconds
            wait(1)
        end
        timerNotOn = true
    end
end
game.Workspace.Part.Touched:Connect(touch)

3 comments

0

interesting bro, but how would I go about detecting the player who did the action? because actually I would like this to happen when a player activates an item from the backpack (he left click on it). The problem is that I don't know how I do it detect which player activated the item

0

You can use remote events to achieve this. Fire the event under the Tool.Activates event right above the for loop, the first argument the server receives is the player who fires the remote

0

and how would i do that?

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