Tween on PrimaryPart only causes one Part to move

My code is as follows:

local TweenService = game:GetService("TweenService")

for _, cube in game.Workspace.Lobby.Decor:GetChildren() do
	if cube.name == "Cube" then
		local t1 = {}
		t1.Position = Vector3.new(cube.PrimaryPart.Position.X, cube.PrimaryPart.Position.Y + 5, cube.PrimaryPart.Position.Z)

		local ti1 = TweenInfo.new(2)
		local tw1 = TweenService:Create(cube.PrimaryPart, ti1, t1)

		tw1:Play()

		local t2 = {}
		t2.Position = Vector3.new(cube.PrimaryPart.Position.X, cube.PrimaryPart.Position.Y - 5, cube.PrimaryPart.Position.Z)

		local ti2 = TweenInfo.new(2)
		local tw2 = TweenService:Create(cube.PrimaryPart, ti2, t2)
		tw1:Play()
		tw1.Completed:Connect(function()
			tw2:Play()
		end)

		tw2.Completed:Connect(function()
			tw1:Play()
		end)
	end
end

And this is what the Cube’s tree looks like in studio:
image

Surely with Outer being welded to the primary part, Inner, the whole cube’s contents would move, no?

Have you tried tweening the PrimaryPart’s CFrame instead of its position?

Y’know how when you move the HumanoidRootPart’s CFrame [of a character] your whole character moves? It’s the same idea here.

1 Like

make sure the other parts are not anchored, also use weldconstaint and not the normal weld as it is deprecated

1 Like

that worked, thank you, it actually made a cooler animation as I was able to incorporate animated rotation too!

1 Like

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