Rest of parts don't rotate with the primary part

I need a model to move and rotate, but the rest of the parts don’t rotate

I have no clue how to fix this…

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()

i can provide an rbxl if needed

2 Likes

How exactly did you define maxwell, did you weld all parts to the part your tweening?

2 Likes

i just noticed i cut off the top line of the script! let me fix that

2 Likes

so now that it’s fixed, maxwell is the primary part of the model
and his whiskers are welded to him

2 Likes

Are they anchored? If so then that’s the problem as I don’t see any mistake in the code.

2 Likes

no parts of the model are anchored

2 Likes

That’s because you’re only tweening the PrimaryPart of the model, moving it do not also move all other parts into the model.

To move an entire model and all the parts it contain, you have to use :PivotTo() on the model itself, but it is unfortunatly not supported into a tween.

So the only solution for you is to weld all the parts together, and tween the CFrame of the PrimaryPart instead of its position and orientation.

You can use this plugin to do it easier, click on the PrimaryPart, then Ctrl + click on all other parts of the model (so they all are selected in blue), go to the plugin tab of your studio, and click on the “Weld All” button.

1 Like

I think you could use PivotTo using cframe values. The downside with this is that the animation can look laggy. Here is an example on how you could use PivotTo:

local model = workspace.insanemodel

local cValue = Instance.new("CFrameValue")
cValue.Parent = workspace

local coolmovingtween = tweenService:Create(cValue, tweeninfo, {Value = CFrame.new(model:GetPivot().Position + Vector3.new(-24, 0, 0))})
		
cValue.Changed:Connect(function(val)
	model:PivotTo(val)
end)
		
coolmovingtween:Play()		
1 Like

here’s so i can close this topic

1 Like

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