How to stop tweened plane from rotation when going straight

I’m trying to make a simple plane flyover with tweening but it rotates slightly even though the destination is directly in front of it.

local sukhoi = script.Parent.Body

local dest = {CFrame = CFrame.new(-1829.508, 1410.51, 3198.732) * sukhoi.CFrame.Rotation}

local tweeninfo = TweenInfo.new(8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = game:GetService("TweenService"):Create(sukhoi, tweeninfo, {CFrame = dest})

wait(15)

tween:Play()

I tried forcing it to keep its rotation with CFrame.Rotation but it gives me and error.

Instead of using CFrame use position, because CFrame combines both and if you use position there is no chance that can happen

But if this is a model there is high chance that the other parts wont follow

1 Like
local dest = {CFrame = CFrame.new(-1829.508, 1410.51, 3198.732) * sukhoi.CFrame.Rotation}

here, you created dest as a table that contains a cframe, but then when you call the tween

local tween = game:GetService("TweenService"):Create(sukhoi, tweeninfo, {CFrame = dest})

you are parsing the entire table. You could fix it by changing that line into this

local tween = game:GetService("TweenService"):Create(sukhoi, tweeninfo, {CFrame = dest.CFrame})

hope this helps!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.