Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i want to make my script short not long like this script?

wait(1)
script.Parent.Text = "1:59"
wait(1)
script.Parent.Text = "1:58"
wait(1)
script.Parent.Text = "1:57"
wait(1)
script.Parent.Text = "1:56"
wait(1)
script.Parent.Text = "1:55"
wait(1)
script.Parent.Text = "1:54"
wait(1)
script.Parent.Text = "1:53"
wait(1)
script.Parent.Text = "1:52"
wait(1)
script.Parent.Text = "1:51"
wait(1)
script.Parent.Text = "1:50"
wait(1)
script.Parent.Text = "1:49"
wait(1)
script.Parent.Text = "1:48"
wait(1)
script.Parent.Text = "1:47"
wait(1)
script.Parent.Text = "1:46"
wait(1)
script.Parent.Text = "1:45"
wait(1)
script.Parent.Text = "1:44"
wait(1)
script.Parent.Text = "1:43"
wait(1)
script.Parent.Text = "1:42"
wait(1)
script.Parent.Text = "1:41"
wait(1)
script.Parent.Text = "1:40"
wait(1)
script.Parent.Text = "1:39"
wait(1)
script.Parent.Text = "1:38"
wait(1)
script.Parent.Text = "1:37"
wait(1)
script.Parent.Text = "1:36"
wait(1)
script.Parent.Text = "1:35"
wait(1)
script.Parent.Text = "1:34"
wait(1)
script.Parent.Text = "1:33"
wait(1)
script.Parent.Text = "1:32"
wait(1)
script.Parent.Text = "1:31"
wait(1)
script.Parent.Text = "1:30"
wait(1)
script.Parent.Text = "1:29"
wait(1)
script.Parent.Text = "1:28"
wait(1)
script.Parent.Text = "1:27"
wait(1)
script.Parent.Text = "1:26"
wait(1)
script.Parent.Text = "1:25"
wait(1)
script.Parent.Text = "1:24"
wait(1)
script.Parent.Text = "1:30"
wait(1)
script.Parent.Text = "1:29"
wait(1)
script.Parent.Text = "1:28"
wait(1)
script.Parent.Text = "1:27"
wait(1)
script.Parent.Text = "1:26"
wait(1)
script.Parent.Text = "1:25"
wait(1)
script.Parent.Text = "1:24"
wait(1)
script.Parent.Text = "1:23"
wait(1)
script.Parent.Text = "1:22"
wait(1)
script.Parent.Text = "1:21"
wait(1)
script.Parent.Text = "1:20"
wait(1)
script.Parent.Text = "1:19"
wait(1)
script.Parent.Text = "1:18"
wait(1)
script.Parent.Text = "1:17"
wait(1)
script.Parent.Text = "1:16"
wait(1)
script.Parent.Text = "1:15"
wait(1)
script.Parent.Text = "1:14"
wait(1)
script.Parent.Text = "1:13"
wait(1)
script.Parent.Text = "1:12"
wait(1)
script.Parent.Text = "1:11"
wait(1)
script.Parent.Text = "1:10"
wait(1)
script.Parent.Text = "1:09"
wait(1)
script.Parent.Text = "1:08"
wait(1)
script.Parent.Text = "1:07"
wait(1)
script.Parent.Text = "1:06"
wait(1)
script.Parent.Text = "1:05"
wait(1)
script.Parent.Text = "1:04"
wait(1)
script.Parent.Text = "1:03"
wait(1)
script.Parent.Text = "1:02"
wait(1)
script.Parent.Text = "1:01"
wait(1)
script.Parent.Text = "1:00"
wait(1)
script.Parent.Text = "0:59"
wait(1)
script.Parent.Text = "0:58"
wait(1)
script.Parent.Text = "0:57"
wait(1)
script.Parent.Text = "0:56"
wait(1)
script.Parent.Text = "0:55"
wait(1)
script.Parent.Text = "0:54"
wait(1)
script.Parent.Text = "0:53"
wait(1)
script.Parent.Text = "0:52"
wait(1)
script.Parent.Text = "0:51"
wait(1)
script.Parent.Text = "0:50"
wait(1)
script.Parent.Text = "0:49"
wait(1)
script.Parent.Text = "0:48"
wait(1)
script.Parent.Text = "0:47"
wait(1)
script.Parent.Text = "0:46"
wait(1)
script.Parent.Text = "0:45"
wait(1)
script.Parent.Text = "0:44"
wait(1)
script.Parent.Text = "0:43"
wait(1)
script.Parent.Text = "0:42"
wait(1)
script.Parent.Text = "0:41"
wait(1)
script.Parent.Text = "0:40"
wait(1)
script.Parent.Text = "0:39"
wait(1)
script.Parent.Text = "0:38"
wait(1)
script.Parent.Text = "0:37"
wait(1)
script.Parent.Text = "0:36"
wait(1)
script.Parent.Text = "0:35"
wait(1)
script.Parent.Text = "0:34"
wait(1)
script.Parent.Text = "0:33"
wait(1)
script.Parent.Text = "0:32"
wait(1)
script.Parent.Text = "0:31"
wait(1)
script.Parent.Text = "0:30"
wait(1)
script.Parent.Text = "0:29"
wait(1)
script.Parent.Text = "0:28"
wait(1)
script.Parent.Text = "0:27"
wait(1)
script.Parent.Text = "0:26"
wait(1)
script.Parent.Text = "0:25"
wait(1)
script.Parent.Text = "0:24"
wait(1)
script.Parent.Text = "0:23"
wait(1)
script.Parent.Text = "0:22"
wait(1)
script.Parent.Text = "0:21"
wait(1)
script.Parent.Text = "0:20"
wait(1)
script.Parent.Text = "0:19"
wait(1)
script.Parent.Text = "0:18"
wait(1)
script.Parent.Text = "0:17"
wait(1)
script.Parent.Text = "0:16"
wait(1)
script.Parent.Text = "0:15"
wait(1)
script.Parent.Text = "0:14"
wait(1)
script.Parent.Text = "0:13"
wait(1)
script.Parent.Text = "0:12"
wait(1)
script.Parent.Text = "0:11"
wait(1)
script.Parent.Text = "0:10"
wait(1)
script.Parent.Text = "0:09"
wait(1)
script.Parent.Text = "0:08"
wait(1)
script.Parent.Text = "0:07"
wait(1)
script.Parent.Text = "0:06"
wait(1)
script.Parent.Text = "0:05"
wait(1)
script.Parent.Text = "0:04"
wait(1)
script.Parent.Text = "0:03"
wait(1)
script.Parent.Text = "0:02"
wait(1)
script.Parent.Text = "0:01"
wait(1)
script.Parent.Text = "0:00"
wait(1)
script.Parent.Text = "1:59"
wait(1)
script.Parent.Text = "1:58"
wait(1)
script.Parent.Text = "1:57"
wait(1)
script.Parent.Text = "1:56"
wait(1)
script.Parent.Text = "1:55"
wait(1)
script.Parent.Text = "1:54"
wait(1)
script.Parent.Text = "1:53"
wait(1)
script.Parent.Text = "1:52"
wait(1)
script.Parent.Text = "1:51"
wait(1)
script.Parent.Text = "1:50"
wait(1)
script.Parent.Text = "1:49"
wait(1)
script.Parent.Text = "1:48"
wait(1)
script.Parent.Text = "1:47"
wait(1)
script.Parent.Text = "1:46"
wait(1)
script.Parent.Text = "1:45"
wait(1)
script.Parent.Text = "1:44"
wait(1)
script.Parent.Text = "1:43"
wait(1)
script.Parent.Text = "1:42"
wait(1)
script.Parent.Text = "1:41"
wait(1)
script.Parent.Text = "1:40"
wait(1)
script.Parent.Text = "1:39"
wait(1)
script.Parent.Text = "1:38"
wait(1)
script.Parent.Text = "1:37"
wait(1)
script.Parent.Text = "1:36"
wait(1)
script.Parent.Text = "1:35"
wait(1)
script.Parent.Text = "1:34"
wait(1)
script.Parent.Text = "1:33"
wait(1)
script.Parent.Text = "1:32"
wait(1)
script.Parent.Text = "1:31"
wait(1)
script.Parent.Text = "1:30"
wait(1)
script.Parent.Text = "1:29"
wait(1)
script.Parent.Text = "1:28"
wait(1)
script.Parent.Text = "1:27"
wait(1)
script.Parent.Text = "1:26"
wait(1)
script.Parent.Text = "1:25"
wait(1)
script.Parent.Text = "1:24"
wait(1)
script.Parent.Text = "1:30"
wait(1)
script.Parent.Text = "1:29"
wait(1)
script.Parent.Text = "1:28"
wait(1)
script.Parent.Text = "1:27"
wait(1)
script.Parent.Text = "1:26"
wait(1)
script.Parent.Text = "1:25"
wait(1)
script.Parent.Text = "1:24"
wait(1)
script.Parent.Text = "1:23"
wait(1)
script.Parent.Text = "1:22"
wait(1)
script.Parent.Text = "1:21"
wait(1)
script.Parent.Text = "1:20"
wait(1)
script.Parent.Text = "1:19"
wait(1)
script.Parent.Text = "1:18"
wait(1)
script.Parent.Text = "1:17"
wait(1)
script.Parent.Text = "1:16"
wait(1)
script.Parent.Text = "1:15"
wait(1)
script.Parent.Text = "1:14"
wait(1)
script.Parent.Text = "1:13"
wait(1)
script.Parent.Text = "1:12"
wait(1)
script.Parent.Text = "1:11"
wait(1)
script.Parent.Text = "1:10"
wait(1)
script.Parent.Text = "1:09"
wait(1)
script.Parent.Text = "1:08"
wait(1)
script.Parent.Text = "1:07"
wait(1)
script.Parent.Text = "1:06"
wait(1)
script.Parent.Text = "1:05"
wait(1)
script.Parent.Text = "1:04"
wait(1)
script.Parent.Text = "1:03"
wait(1)
script.Parent.Text = "1:02"
wait(1)
script.Parent.Text = "1:01"
wait(1)
script.Parent.Text = "1:00"
wait(1)
script.Parent.Text = "0:59"
wait(1)
script.Parent.Text = "0:58"
wait(1)
script.Parent.Text = "0:57"
wait(1)
script.Parent.Text = "0:56"
wait(1)
script.Parent.Text = "0:55"
wait(1)
script.Parent.Text = "0:54"
wait(1)
script.Parent.Text = "0:53"
wait(1)
script.Parent.Text = "0:52"
wait(1)
script.Parent.Text = "0:51"
wait(1)
script.Parent.Text = "0:50"
wait(1)
script.Parent.Text = "0:49"
wait(1)
script.Parent.Text = "0:48"
wait(1)
script.Parent.Text = "0:47"
wait(1)
script.Parent.Text = "0:46"
wait(1)
script.Parent.Text = "0:45"
wait(1)
script.Parent.Text = "0:44"
wait(1)
script.Parent.Text = "0:43"
wait(1)
script.Parent.Text = "0:42"
wait(1)
script.Parent.Text = "0:41"
wait(1)
script.Parent.Text = "0:40"
wait(1)
script.Parent.Text = "0:39"
wait(1)
script.Parent.Text = "0:38"
wait(1)
script.Parent.Text = "0:37"
wait(1)
script.Parent.Text = "0:36"
wait(1)
script.Parent.Text = "0:35"
wait(1)
script.Parent.Text = "0:34"
wait(1)
script.Parent.Text = "0:33"
wait(1)
script.Parent.Text = "0:32"
wait(1)
script.Parent.Text = "0:31"
wait(1)
script.Parent.Text = "0:30"
wait(1)
script.Parent.Text = "0:29"
wait(1)
script.Parent.Text = "0:28"
wait(1)
script.Parent.Text = "0:27"
wait(1)
script.Parent.Text = "0:26"
wait(1)
script.Parent.Text = "0:25"
wait(1)
script.Parent.Text = "0:24"
wait(1)
script.Parent.Text = "0:23"
wait(1)
script.Parent.Text = "0:22"
wait(1)
script.Parent.Text = "0:21"
wait(1)
script.Parent.Text = "0:20"
wait(1)
script.Parent.Text = "0:19"
wait(1)
script.Parent.Text = "0:18"
wait(1)
script.Parent.Text = "0:17"
wait(1)
script.Parent.Text = "0:16"
wait(1)
script.Parent.Text = "0:15"
wait(1)
script.Parent.Text = "0:14"
wait(1)
script.Parent.Text = "0:13"
wait(1)
script.Parent.Text = "0:12"
wait(1)
script.Parent.Text = "0:11"
wait(1)
script.Parent.Text = "0:10"
wait(1)
script.Parent.Text = "0:09"
wait(1)
script.Parent.Text = "0:08"
wait(1)
script.Parent.Text = "0:07"
wait(1)
script.Parent.Text = "0:06"
wait(1)
script.Parent.Text = "0:05"
wait(1)
script.Parent.Text = "0:04"
wait(1)
script.Parent.Text = "0:03"
wait(1)
script.Parent.Text = "0:02"
wait(1)
script.Parent.Text = "0:01"
wait(1)
script.Parent.Text = "0:00"

pls help me i want to make it short

6 comments

0

You could try to use loops

0

Also, when you're posting a code, please refrain from posting it outside of a code block. To access the code block, simply click the Lua logo in the Text Box when you're typing your question. Then insert your code.

0

Wow, you had the patience to write this?

0

I put you code in a codeblock. In the future, I recommend you do this yourself: https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site

0

Mother of god......

0

god tier

3 answers

✓ Accepted answer

First of all, wow. This is one hell of a monstrosity.

Anyway, just use loops; Loops are your friend!

The simplest form of loops, while loops, execute as long as their condition is true:

local var = 0

while var < 10 do
    print(var)
    
    var = var + 1
end

There are also repeat ... until loops, which are similar to while loops. These loops will do the opposite of while loop in that instead of looping as long as their condition is true, they will, as their name suggest, loop until some false condition becomes true:

local humanoid = character:FindFirstChildOfClass("Humanoid")

if humanoid and humanoid.Health > 0 then
	repeat
		humanoid:TakeDamage(5)
		
		wait(2)
	until humanoid.Health == 0
end

Note that a repeat loop's body will always execute at least once since the condition is checked at the end of each step of the loop.

If you want to repeat an action some known amount of times, just use a numeric for loop:

for i = 1, 100, 2 do
	-- This will count from 1 to 100 in steps of 2.
	print(i)
end

If the step is of 1 then you can safely omit it:

for i = 1, 100 do
	-- This will count from 1 to 100 in steps of 1.
	print(i)
end

You can also count down using a negative step:

for i = 99, 1, -1 do
	print( i .. " bottle" .. (i > 1 and 's' or '') .. " of beer on the wall")
end

print("No more bottles of beer on the wall.")

And If you want something to happen forever and ever, you can use an infinite loop`:

print("This shall loop forever and")

while true do
	print("ever and")

	wait(2)
end

But make sure to wait() before the end of an infinite loop, otherwise Roblox will hang! Furthermore, if your wait time is small then you should consider using RunService.Stepped or RunService.HeartBeat instead!

Link150 didn't actually include your code in a shortened form, here's that, using two methods:

Method 1: nested loops

for minute = 1, 0, -1 do
	for seconds = 59, 10, -1 do
		script.Parent.Text = minute .. ":" .. seconds
		wait(1)
	end
	for seconds = 9, 0, -1 do
		script.Parent.Text = minute .. ":0" .. seconds
		wait(1)
	end
end

Method 2: math & ternary statement

for seconds = 119, 0, -1 do --119 and not 120 since you start at 1:59
	script.Parent.Text = math.floor(seconds/60) .. ":" .. (seconds%60 < 10 and "0" or "") .. seconds%60
	end
end

3 comments

0

for the 01:01 situation you can just do ("00"..seconds):sub(-2) to get the last 2 chars.

1

Was that really necessary? I didn't rewrite their code on purpose; I left it as an exercise.

0

Besides, all of this could be summed up in a single function call: string.format("d:% 02d", math.floor(time/60)%60, time%60)

U simply cant.

16 comments

6

Yes he can, using loops. Also please refrain from leaving answers that should be comments.

5

Wow... I really hate ill informed answers. You know, you should really remove this answer.

3

classic

4

HAAHHAHAHAHAHAHAHHAHAHAAHAHAHAHAHAH

4

posting to be part of history

3

The best answer on scripting helpers as of yet.

3

It is also the most popular by far. People are still talking about it 1 year after it was posted.

4

Give this man a medal.

3

yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet ya

3

The man, the myth, the legend

2

h

2

same

2

yes

2

yes

2

Legends never die.

1

I am amazed this question was not locked.

This discussion is preserved as it was. New answers, comments, and votes are closed.