Tween loop is being weird

So I made a script that would make a part rotate 360 degrees all the time (I used three tweens because TweenService takes the shortest route) and here it is:

wait(1)
local tweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0)
local info = {Rotation = Vector3.new(0, 120, 0)}
local info2 = {Rotation = Vector3.new(0, 240, 0)}
local info3 = {Rotation = Vector3.new(0, 0, 0)}

local tween = tweenService:Create(script.Parent, tweenInfo, info)
local tween2 = tweenService:Create(script.Parent, tweenInfo, info2)
local tween3 = tweenService:Create(script.Parent, tweenInfo, info3)

while true do
	tween:Play()
	tween.Completed:Wait()
	tween2:Play()
	tween2.Completed:Wait()
	tween3:Play()
	tween3.Completed:Wait()
end

The thing is, the part rotates all other ways instead of just one way.

Why is this happening? Should I not use TweenService for this?

you could tween it indefinitely by setting the repeat count to a number below 0, using just one Tween.

you could use a local script to do it on the client, using CFrame too
    local part = workspace:WaitForChild("Part")
    game:GetService("RunService").Heartbeat:connect(function(dt)
	     part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(5.5)*dt*60, 0)
    end)
2 Likes

what should I make this then?

through the Heartbeat event, it is passed itself; the step argument (delta time)

1 Like