Scripting Lesson 006: Rotating Bricks

Hello everyone, and welcome back to the scripting lessons. This lesson will be a pretty complicated one but is here because many people have asked me how to make a brick automatically move. An example of this is at our Headquarters. CFraming can be tough to get at first but don't get discouraged.

Now the script is pretty simple but if you find a free model version, you will find many complicated ones. I am only going to show you the simplest form of the script.

Now as you may notice the fromEulerAnglesXYZ in this script. CFrame.fromEulerAnglesXYZ is a method used to rotate parts. This is done in a unit called radians.

One radian is equal to the radius of a unit circle. For those few who may not know, Pi is the ratio of the circumference to the diameter of a circle, and is approximately 3.14. So 3.14 radians is the same as a 180 degree turn. Unfortunately, you can not type a pi symbol in a script, but you still can do some basic math to figure out what to type in for any number you want. To help calculate this, the ratio between radians and degrees is 1:57.3248408 (Huge decimal for exact measurements, feel free to round if you don't mind). So 0.1 times 57.5 is 5.75. PM me if you need me to help you with this math, but math is a crucial part of advanced scripting.

Extra Practice- Make a rotating blade that will kill you on touch.

-Domswolf