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 6 years ago
Edited 6 years ago

I tried making a countdown timer

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

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
6 years ago

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

This is the correct script:

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

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 — 6y
0
Learn it and it will work! Oficcer_F 207 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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

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

you should do

1local Var1 = 600
2script.Parent.Text = Var1
3for x = 1, Var1 do
4    Var1 = Var1 - 1
5script.Parent.Text = Var1
6    wait(1)
7end

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

1local Var1 = 600
2script.Parent.Text = Var1
3for x = 1, Var1 do
4    script.Parent.Text = script.Parent.Text - 1
5    wait(1)
6end

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 — 6y
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
1local num = 600
2 
3for i = 1,600 do
4script.Parent.Text = num
5    wait(1)
6    num = num -1
7    print(num)
8    end
0
^ I hope it worked! (i tested it in studio, so it should work.) User#22722 20 — 6y
0
sorry did not worked :( ZorbaTheGreatGreek 59 — 6y

Answer this question