Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I make my countdown/timer script work like its supposed to? (SOLVED)

Asked by 4 months ago
Edited 4 months ago

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 
0
because you arent looping it. greatneil80 2240 — 4mo
0
put after line 12 script.ScreenGui.TextButton.Text = tostring(time) greatneil80 2240 — 4mo
0
do i remove script.ScreenGui.TextButton.Text = tostring(time) from line 6 as well? ErskinePierre 48 — 4mo

1 answer

Log in to vote
0
Answered by 4 months ago
Edited 4 months ago

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.

Ad

Answer this question