Help with tweening a model

I am trying to animate my 737 landing which the plane itself consists of a few meshes made in blender with 2 hinge constraints for the engines to spin, it is all a single model and welded correctly etc. However my script is only moving the primary part of the model (Aka the fuselage). Help will be appreciated, Here’s the script:

local tweenservice = game:GetService("TweenService")

local Fuselage = script.Parent.PrimaryPart

local WPT1Goals = {

Position = Vector3.new(-816.563, 194.746, -1677.747),

Orientation = Vector3.new(0, -90, 2.5)

}

local WPT2Goals = {

Position = Vector3.new(-816.563, 102.746, -61.747),

Orientation = Vector3.new(0, -90, 4)

}

local WPT3Goals = {

Position = Vector3.new(-816.563, 40.746, 142.253),

Orientation = Vector3.new(0, -90, 5)

}

local WPT4Goals = {

Position = Vector3.new(-816.563, 40.746, 492.253),

Orientation = Vector3.new(0, -90, -0.75)

}

local WPT5Goals = {

Position = Vector3.new(-816.563, 40.746, 2062.252),

Orientation = Vector3.new(0, -90, -0.75)

}

local WPT1Info = TweenInfo.new(

10,

Enum.EasingStyle.Linear,

Enum.EasingDirection.InOut,

0,

false,

0

)

local WPT2Info = TweenInfo.new(

5,

Enum.EasingStyle.Linear,

Enum.EasingDirection.InOut,

0,

false,

0

)

local WPT3Info = TweenInfo.new(

4,

Enum.EasingStyle.Linear,

Enum.EasingDirection.InOut,

0,

false,

0

)

local WPT4Info = TweenInfo.new(

2,

Enum.EasingStyle.Linear,

Enum.EasingDirection.InOut,

0,

false,

0

)

local WPT5Info = TweenInfo.new(

5,

Enum.EasingStyle.Linear,

Enum.EasingDirection.InOut,

0,

false,

0

)

local WPT1 = tweenservice:Create(Fuselage, WPT1Info, WPT1Goals)

local WPT2 = tweenservice:Create(Fuselage, WPT2Info, WPT2Goals)

local WPT3 = tweenservice:Create(Fuselage, WPT3Info, WPT3Goals)

local WPT4 = tweenservice:Create(Fuselage, WPT4Info, WPT4Goals)

local WPT5 = tweenservice:Create(Fuselage, WPT5Info, WPT5Goals)

while true do

wait(10)

WPT1:Play()

wait(10)

WPT2:Play()

wait(5)

WPT3:Play()

wait(4)

WPT4:Play()

wait(2)

WPT5:Play()

end

Kind regards, Ducks.

FnunyGuy#5742 On Discord

when moving models you have to weld everything to a main part (your primaryPart) then set its CFrame to move them, usually done through SetPrimaryPartCFrame() i believe tweening just the cframe should still work

CFrame is the same value as the position right?

Sorry, I can’t get the script right, Could you maybe give an example?

no cframe is not

to tween cframe you use the data as

{ CFrame = CFrame.new(vector3 or position of another part) or cframe of another part }

its easier to place anchored parts and use their positions/cframe instead of converting cframe to vector3 then back

It works (sorta), the entire aircraft now goes to where its supposed to go. However; It changes it’s Orientation to 0, 0, 0. Here’s my current script because I am 99% sure this is where it goes wrong.

local tweenservice = game:GetService("TweenService")
local Fuselage = script.Parent.PrimaryPart

local WPT1Goals = {
	CFrame = CFrame.new(-816.563, 194.746, -1677.747),
}
local WPT2Goals = {
	CFrame = CFrame.new(-816.563, 102.746, -61.747),
}
local WPT3Goals = {
	CFrame = CFrame.new(-816.563, 40.746, 142.253),
}
local WPT4Goals = {
	CFrame = CFrame.new(-816.563, 40.746, 492.253),
}
local WPT5Goals = {
	CFrame = CFrame.new(-816.563, 40.746, 2062.252),
}

local WPT1Info = TweenInfo.new(
	10,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local WPT2Info = TweenInfo.new(
	5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local WPT3Info = TweenInfo.new(
	4,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local WPT4Info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local WPT5Info = TweenInfo.new(
	5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local WPT1 = tweenservice:Create(Fuselage, WPT1Info, WPT1Goals)

local WPT2 = tweenservice:Create(Fuselage, WPT2Info, WPT2Goals)

local WPT3 = tweenservice:Create(Fuselage, WPT3Info, WPT3Goals)

local WPT4 = tweenservice:Create(Fuselage, WPT4Info, WPT4Goals)

local WPT5 = tweenservice:Create(Fuselage, WPT5Info, WPT5Goals)


while true do
	wait(5)
	WPT1:Play()
	wait(10)
	WPT2:Play()
	wait(5)
	WPT3:Play()
	wait(4)
	WPT4:Play()
	wait(2)
	WPT5:Play()
end

CFrame positioning works and I understand that now, I just don’t understand how to rotate it because when I add an “Orientation = Vector3.new(Orientation Numbers,)” It starts rapidly, And I mean rapidly spinning, any way to do this?

1 Like

cframe is rotation AND position

i suggest you use parts with the front face matching the plane’s front face to get the orientation correct

then use those part’s cframe for the tweens

to get the front face place a empty decal in the part and whatever it highlights is the front face

1 Like

How can I combine Rotation and Position?

Currently I’ve only got

CFrame = CFrame.new(Value, Value, Value)

like i said, since your cframe values are constant use invisible parts and take THEIR cframe

local data1 = { CFrame = workspace.Part1.CFrame }

whatever their FRONT face is will be the front face for the model’s primary part, recommended to copy the primary part for the invisible parts

for manually setting it (not recommended) you do this

local data1 = { CFrame = CFrame.new(x, y, z) * CFrame.Angles(x, y, z) }
-- CFrame.Angles takes math.rad() values
1 Like

so “local data1” will be one of the Goals of the tween (WPT1-5)?