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

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

Asked by 7 years ago
Edited by OldPalHappy 7 years ago
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

0
You could try to use loops kristibezatlliu1111 33 — 7y
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. Async_io 908 — 7y
0
Wow, you had the patience to write this? AZDev 590 — 7y
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 OldPalHappy 1477 — 7y
View all comments (2 more)
0
Mother of god...... T0XN 276 — 6y
0
god tier EpicMetatableMoment 1444 — 6y

Locked by TheeDeathCaster

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
9
Answered by
Link150 1355 Badge of Merit Moderation Voter
7 years ago
Edited 7 years ago

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!

Ad
Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
7 years ago

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
0
for the 01:01 situation you can just do ("00"..seconds):sub(-2) to get the last 2 chars. RubenKan 3615 — 7y
1
Was that really necessary? I didn't rewrite their code on purpose; I left it as an exercise. Link150 1355 — 7y
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) Link150 1355 — 7y
Log in to vote
-16
Answered by
dyon0 -37
7 years ago

U simply cant.

6
Yes he can, using loops. Also please refrain from leaving answers that should be comments. Async_io 908 — 7y
5
Wow... I really hate ill informed answers. You know, you should really remove this answer. AZDev 590 — 7y
3
classic User#19524 175 — 6y
4
HAAHHAHAHAHAHAHAHHAHAHAAHAHAHAHAHAH greatneil80 2647 — 6y
View all comments (12 more)
4
posting to be part of history green271 635 — 6y
3
The best answer on scripting helpers as of yet. User#21908 42 — 6y
3
It is also the most popular by far. People are still talking about it 1 year after it was posted. User#21908 42 — 6y
4
Give this man a medal. ee0w 458 — 6y
3
yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet ya Zafirua 1348 — 6y
3
The man, the myth, the legend RayCurse 1518 — 6y
2
h BenSBk 781 — 6y
2
same DaCrazyDev 444 — 6y
2
yes EpicMetatableMoment 1444 — 6y
2
yes EpicMetatableMoment 1444 — 6y
2
Legends never die. TheeDeathCaster 2368 — 6y
1
I am amazed this question was not locked. User#21908 42 — 6y