How to make a part spin smoothly

  1. What do you want to achieve?
    Hello, i want to make a part spin on itself smoothly.

  2. What is the issue?
    I don’t know how to do it.

  3. What solutions have you tried so far?
    I tried myself, looked on forums.

1 Like

This may refer, I guess

1 Like

Thank you, and if i want to adjust the speed of the spin i just change the tween time ?

There are multiple ways to go about this. Two methods that I would personally use are TweenService and using CFrame.

CFrame:

while wait() do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(1), 0)
end

TweenService

local TS = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

local OriginalOrientation = script.Parent.Orientation
local GoalOrientation = Vector3.new(script.Parent.Orientation.X, script.Parent.Orientation.Y + 360, script.Parent.Orientation.Z)

local RotateTween = TS:Create(script.Parent, tweenInfo, {Orientation = GoalOrientation})

RotateTween:Play()

I prefer the TweenService one more as it gives you way more control over the speed of the turning.

Note: Both codes are written assuming the code is in a ServerScript and is a child of the part that you would want to spin.

2 Likes