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 make my countdown/timer script work like its supposed to? (SOLVED)

I don't know why it isn't working. The Text Button gets cloned into the GUI, but the actual text inside the button wont update with the time.

local time = 120

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        script.ScreenGui:Clone().Parent = player.PlayerGui
        script.ScreenGui.TextButton.Text = tostring(time)
    end)
end)

for i = 1, 120 do
wait(1) 
time = time - 1
end 

3 comments

0

because you arent looping it.

0

put after line 12 script.ScreenGui.TextButton.Text = tostring(time)

0

do i remove script.ScreenGui.TextButton.Text = tostring(time) from line 6 as well?

1 answer

I figured out how to fix it.

local time = 100

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
	for i = 1, 100 do
		script.ScreenGui:Clone().Parent = player.PlayerGui
wait(1)
script.ScreenGui.TextButton.Text = tostring(time)
time = time - 1
end
    end)
end)

Feel free to use it.

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