How to Make a Spinning Brick Script in "ROBLOX"

by Anthony Wade PearsonUpdated September 22, 2017

In the online game “Roblox,” a script is a Lua programming tool inserted into the blocks that make up each place. Scripting is what brings a place to life, giving players things to interact with. Any object that moves has a script telling it how to do so. Bricks can be scripted to crawl like an animal, fly like a plane or shoot like a bullet. To build a spinning sign, a merry-go-round or a fan, you need a script to tell the brick in which direction to spin and how fast.

Log on to your “Roblox” place in “Build” mode.

Click “Roblox Studio” on the bottom of the game window, then click “Pause” on the toolbar at the top.

Click “Insert” on the toolbar, then “Object...” from the drop-down menu.

Select “Part” from the third column of the “Insert Object” list, then click “OK”.

Click “Cut” then “Paste” on the toolbar to place the part in front of you.

Click “Insert” on the toolbar, then “Object...” from the drop-down menu.

Select “Script” from the third column of the “Insert Object” list, then click “OK”.

Locate the part you inserted under “Workspace” within the “Explorer” box to the right and double-click the script that has been inserted into it. This opens a page to enter script to command the block it is placed within.

Delete “print 'Hello world!'” from line one to leave the script blank.

Type the following code --excluding quotes-- on lines 1-5 of the script page:

"a = script.Parent while true do a.CFrame = a.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0) wait() end"

Change the speed in which your block is to spin by replacing the 0 with a decimal from .01-1.0. The first number represents the X axis, spinning the block top to bottom towards its face. The second number represents the Y axis, spinning the block on its base. The third number represents the Z axis, spinning the block around its edge.

Click the "x" at the top right of the script page to exit it. There is no save button for the script.

Click “Play”. You should see your brick rotating.


A negative number reverses the rotational direction of the brick. If you want the brick to be elevated, first use the “Move on axis” tool to raise it and then the “Anchor” tool to lock it in place before pushing “Run”. If you change the XYZ values, you must cut the script from the block, then paste it back for the changes to take place.


About the Author

Anthony Wade Pearson's writing experience has ranged from updating Standard Operating Procedures in the U.S. Army to creating Material Safety Data Sheets for hazardous chemicals, to creating lesson plans for ESL students. Pearson earned his Bachelor of Science in computer science in 2009 and has since returned to his interest in creative writing.

More Articles