Project 563: Spinning Blocks

8. Consolidate Your Code (Optional)

Sometimes (but not always) in code, the fewer lines, the better. Let's go back into your SpinScript and see if you can shorten your code to make it a little neater and more efficient.
Starting point file for this challenge

Steps

1. Open a SpinScript from one of your SpinningBlocks

Open one of your SpinScripts.

2. Integrate 'wait' into your while-loop

You want the game to wait 0.001 seconds between each time it runs the code in your while-loop. Instead of having the 'wait(0.001)' on its own line, you can combine that with your while-loop to get the same result by replacing the 'true' with 'wait(0.001)'.
while wait(0.001) do

3. Remove 'block' variable

The block variable represents the parent of the script, you do this to so you don't have to write out 'script.Parent' every time you need it in the code. But we only use the block variable once in our code, so it is not necessary to create a new variable when we can easily use the 'script.Parent'.

Delete the first line of your code where you create your block variable.

Replace 'block' on the first line inside your while-loop with 'script.Parent'
script.Parent.Orientation = Vector3.new(0, rotation, 0)