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
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
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.
local num = 600 for i = 1,600 do script.Parent.Text = num wait(1) num = num -1 print(num) end