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

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

Asked by 4 years ago
Edited 4 years 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 2647 — 4y
0
put after line 12 script.ScreenGui.TextButton.Text = tostring(time) greatneil80 2647 — 4y
0
do i remove script.ScreenGui.TextButton.Text = tostring(time) from line 6 as well? ErskinePierre 48 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years 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