I made wind turbines that spin forever, and found out you’re better off using a weld between two parts, and Tweening the weld’s C1 or C0, for ease and to be able to move the object mid tween.
Even if you do it straight on the part, the process is the same.
Create three CFrames - the first being at 120 degrees off, the second being 240 degrees off and the third back at the original orientation.
Tween to the first, listen for Tween.Completed event. Tween to the next, listen for Tween.Completed event.
There is absolutely no harm doing this inside of a while loop whilst you want it to keep spinning. You can put the properties into an array, increment a counter, and pick from the array for the next goal.
local TweenService = game:GetService( 'TweenService' )
local spin = script.Parent
local spinning = true
local goals = {}
local tweenInfo = TweenInfo.new(
3, -- Length (seconds)
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out
)
goals[ 1 ] = spin.CFrame * CFrame.Angles( 0, math.rad( 120 ), 0 )
goals[ 2 ] = spin.CFrame * CFrame.Angles( 0, math.rad( 240 ), 0 )
goals[ 3 ] = spin.CFrame
local i = 0
while spinning do
i = i % #goals + 1
local tween = TweenService:Create( spin, tweenInfo, { CFrame = goals[ i ] } )
tween:Play()
local state = tween.Completed:Wait()
if state == Enum.PlaybackState.Cancelled then
warn( 'Tween cancelled' )
break
end
end
So you start the next tween as the previous one finishes. You’re better off using CFrame as it won’t do strange things when reaching 360 degrees whereas Orientation probably will due to it not being a CFrame and not having the same lerping abilities.
I’m on mobile so I can’t watch your video, but if it turns out you want this spinner to be able to move position, and that’s why you only messed with Orientation, then use the welding method mentioned before, and swap out spin.CFrame for Weld.C0 or Weld.C1.