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

How would I make this script shorter? [SOLVED]

How to make this shorter? I want it to keep going and never stop. I want the rotation to never stop going up, and the scripts parent is a text button.

if script.Disabled == false then   - - I'm too lazy to find how to start a script                  - - when the game starts :p

    script.Parent.Rotation = 1
    wait(0.01)
    script.Parent.Rotation = 2
    wait(0.01)
    script.Parent.Rotation = 3
    wait(0.01)
    script.Parent.Rotation = 4
    wait(0.01)
    script.Parent.Rotation = 5
    wait(0.01)
    script.Parent.Rotation = 6
    wait(0.01)
    script.Parent.Rotation = 7
    wait(0.01)
    script.Parent.Rotation = 8
    wait(0.01)
    script.Parent.Rotation = 9
    wait(0.01)
    script.Parent.Rotation = 10
    wait(0.01)
    script.Parent.Rotation = 11
    wait(0.01)
    script.Parent.Rotation = 12
    wait(0.01)
    script.Parent.Rotation = 13
    wait(0.01)
    script.Parent.Rotation = 14
    wait(0.01)
    script.Parent.Rotation = 15
    wait(0.01)
    script.Parent.Rotation = 16
    wait(0.01)
    script.Parent.Rotation = 17
    wait(0.01)
    script.Parent.Rotation = 18
    wait(0.01)
    script.Parent.Rotation = 19
    wait(0.01)
    script.Parent.Rotation = 20
    wait(0.01)
    script.Parent.Rotation = 21
    wait(0.01)
    script.Parent.Rotation = 22
    wait(0.01)
    script.Parent.Rotation = 23
    wait(0.01)
    script.Parent.Rotation = 24
    wait(0.01)
    script.Parent.Rotation = 25
    wait(0.01)
    script.Parent.Rotation = 26
    wait(0.01)
    script.Parent.Rotation = 27
    wait(0.01)
    script.Parent.Rotation = 28
    wait(0.01)
    script.Parent.Rotation = 29
    wait(0.01)
    script.Parent.Rotation = 30
    wait(0.01)
    script.Parent.Rotation = 31
    wait(0.01)
    script.Parent.Rotation = 32
    wait(0.01)
    script.Parent.Rotation = 33
    wait(0.01)
    script.Parent.Rotation = 34
    wait(0.01)
    script.Parent.Rotation = 35
    wait(0.01)
    script.Parent.Rotation = 36
    wait(0.01)
    script.Parent.Rotation = 37
    wait(0.01)
    script.Parent.Rotation = 38
    wait(0.01)
    script.Parent.Rotation = 39
    wait(0.01)
    script.Parent.Rotation = 40
    wait(0.01)
    script.Parent.Rotation = 41
    wait(0.01)
    script.Parent.Rotation = 42
    wait(0.01)
    script.Parent.Rotation = 43
    wait(0.01)
    script.Parent.Rotation = 44
    wait(0.01)
    script.Parent.Rotation = 45
    wait(0.01)
    script.Parent.Rotation = 46
    wait(0.01)
    script.Parent.Rotation = 47
    wait(0.01)
    script.Parent.Rotation = 48
    wait(0.01)
    script.Parent.Rotation = 49
    wait(0.01)
    script.Parent.Rotation = 50
    wait(0.01)
    script.Parent.Rotation = 51
    wait(0.01)
      end 

1 comment

0

By the way, you can remove that entire if statement surrounding this. Scripts will automatically run anywhere that they are able to run if not disabled.

3 answers

✓ Accepted answer

This can be done in a loop...

local rotation = 0
while rotation ~= 52 do --So if the rotation is not 52... hmm... Carry on.
wait() --Wait for it. Wait for it. o.O
script.Parent.Rotation = rotation --Set the rotation to the number the loop is on.
rotation = rotation + 1 --One step closer to being finished.
end --Well, the loop has to end somewhere.
--Rotation should be 51 here.

2 comments

0

Could you keep it going forever and not stop at 51?

1

Yes, just remove rotation ~= 52 and replace it with true.

while wait(.01) do
script.Parent.Rotation = script.Parent.Rotation + 1
end

should work :)

if script.Disabled == false then
for i = 1,360 do -- Repeats this thing 51 times.
script.Parent.Rotation = script.Parent.Rotation +1
wait(0.01)
end
end

if this helped +1

1 comment

0

I wanted it to keep going and not stop at 51 nor any number.

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