How would I tween BOTH position and rotation of a model

PLEASE READ:
I am trying to tween the position AND rotation of a model. This is multiple parts welded together connected with a primary part.

part of my issue is the tween must move up and down slowly with the easing style “Sine”
and the tween must rotate 360 degrees around with the easing style “Linear”

I’m doing something wrong with my current script (see below) as it only applies the tween to the primary part. No other parts in the model move with it.

-All of the parts are welded together
-The model has a primary part

local maxwell = script.Parent.PrimaryPart
local maxwellPos = maxwell.Position
local maxwellrot = maxwell.Rotation

local tweenservice = game:GetService("TweenService")

local info1 = TweenInfo.new(
	0.8,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	-1,
	true
)

local info2 = TweenInfo.new(
	2.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	-1,
	false
)

local newTween = tweenservice:Create(maxwell, info1,{ Position = maxwellPos + Vector3.new(0, 1, 0)})
local newTween2 = tweenservice:Create(maxwell, info2,{ Rotation = maxwellrot + Vector3.new(0, 360, 0)})
newTween:Play()
newTween2:Play()

Thank you, I am not good at scripting, and I am getting desperate

maxwell dance.rbxl (89.9 KB)
– the project file if needed

You should use CFrame instead of Position

I tested the game and it seemed to work fine? all parts in the model moved (the whiskers and the cat) and the rotation and movement played at the same time? What am I missing?

You need to use CFrame instead of Position and Rotation.

Position and Rotation only move a single object, the selected one, even if other parts are weld to it.

CFrame move a group of objects, so it move the selected part and all the parts welded to it.

tweenservice:Create(maxwell, info1, {CFrame = maxwell.CFrame * CFrame.new(Vector3.new(0, 1, 0))}):Play()
tweenservice:Create(maxwell, info2, {CFrame = maxwell.CFrame * CFrame.Angles(0, 360, 0)}):Play()
1 Like