TweenService issue, parts turning?

I was just using the tweenservice, and I tested it out. When I tested it out, I found out that the parts are rotating, even though I never told it to do that, I only told it to go to 0, 0, 0.

local TweenS = game:GetService("TweenService")
local part = script.Parent
local Info = TweenInfo.new(
     180,
     Enum.EasingStyle.Linear,
     Enum.EasingDirection.Out,
     0,
     false,
     10
)

local Goals = {
CFrame = CFrame.new(Vector3.new(0, 0, 0))
}

local tween = TweenS:Create(part, Info, Goals)
tween:Play()

I couldn’t find any solution on google, so any help is appreciated.

Could you upload a GIF please? I just tried your exact script out and it works perfectly fine. However, you should tween position rather than CFrame as CFrames carry rotation data.

Do you have any bodymovers within the part(s) you’re moving?

1 Like

Tweening CFrames will also manipulate the objects rotation. Use position instead.

local TweenS = game:GetService("TweenService")
local part = script.Parent
local Info = TweenInfo.new(
     180,
     Enum.EasingStyle.Linear,
     Enum.EasingDirection.Out,
     0,
     false,
     10
)

local Goals = {
Position = Vector3.new()
}

local tween = TweenS:Create(part, Info, Goals)
tween:Play()

Edit: Alternatively, if you still want to tween the CFrame instead of the Position property, you can create a new CFrame with the objects current rotation.

local TweenS = game:GetService("TweenService")
local part = script.Parent
local Info = TweenInfo.new(
     180,
     Enum.EasingStyle.Linear,
     Enum.EasingDirection.Out,
     0,
     false,
     10
)

local Goals = {
CFrame = CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(part.CFrame:ToEulerAnglesXYZ())
}

local tween = TweenS:Create(part, Info, Goals)
tween:Play()
5 Likes