Spinning Part¶
Difficulty¶
This is an easy tutorial.
Setup¶
No setup is required. All you need to do is attach this to an existing Part.
Code¶
- This line creates the
speedvariable, and gives it a value of25. This will be used later, on line 5. - As mentioned in Globals/Lifetime Functions, this fires every frame.
- This line gets the current rotation of the Instance that the script is attached to.
- This line creates a new Vector3, with the X and Y set to 0, with the Z axis being set to
speed * dt. Multiplying the speed bydtensures it rotates smoothly despite lag.