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

I need help with this gui countdown? (tried almost every tutorial on youtube and the roblox discord)

Asked by 5 years ago
Edited 5 years ago

I tried making a countdown timer

local Var1 = 600
for x = 1, Var1 do
    script.Parent.Text = Var1-x
    wait(1)
end

people tried to help me on Roblox discord but they were no help so here is the code I have currently im making an event system where it loads in the map and if people click the join button theyll go to the map im using a regular script in a text thing the text thing is called Text the parent of the text is Event

please someone help me i dont wanna repeat a line of code 600 times

3 answers

Log in to vote
1
Answered by
Oficcer_F 207 Moderation Voter
5 years ago

Hello, you that you are setting the starting value to one and the taking minus x.

This is the correct script:

local number = 600
for x = number, 1, -1 do --third argument is the increment
    script.Parent.Text = x
    wait(1)
end

REMEMBER TO ACCEPT THE ANSWER IF IT WORKED

0
0
Hello, the problem is that you need to use remote events.For example, FireAllClients(). Here is a link; https://www.youtube.com/watch?v=C0qQ4lDa3t0 Oficcer_F 207 — 5y
0
Learn it and it will work! Oficcer_F 207 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

I have a timer as well and I feel that what you're doing is slightly wrong. Rather than doing

local Var1 = 600
for x = 1, Var1 do
    script.Parent.Text = Var1-x
    wait(1)
end

you should do

local Var1 = 600
script.Parent.Text = Var1
for x = 1, Var1 do
    Var1 = Var1 - 1
script.Parent.Text = Var1
    wait(1)
end

So what this does is it will subtract one from the text and rather than doing do you did just do it like that.

so now it will be 600 and subtract one from it.

or you can do

local Var1 = 600
script.Parent.Text = Var1
for x = 1, Var1 do
    script.Parent.Text = script.Parent.Text - 1
    wait(1)
end

They both work the first one is more for you though.

0
alright change var1 from for x = 1, Var1 do, change it to for x = 1, 599 do. Reason being your value is 600 so it will go down six hundred times. GameBoyOtaku 63 — 5y
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
local num = 600

for i = 1,600 do
script.Parent.Text = num
    wait(1)
    num = num -1 
    print(num)
    end
0
^ I hope it worked! (i tested it in studio, so it should work.) User#22722 20 — 5y
0
sorry did not worked :( ZorbaTheGreatGreek 59 — 5y

Answer this question