How to move Motor6D with TweenService

Let’s keep things short, I just want all players bodyparts to effectively move to the centre of the body as shown in the animation below;

Here is a script I made that;

local ts = game:GetService("TweenService")

local middle = Vector3.new(0,0,0)
local down = Vector3.new(0, -2, 0)

local npc = script.Parent
local root = npc:FindFirstChild("HumanoidRootPart")
local torso = npc:FindFirstChild("Torso")

for _, motor in pairs(npc:GetDescendants()) do
	if motor:IsA("Motor6D") then
		ts:Create(motor.C0, TweenInfo.new(1), {Position = middle}):Play()
	end
end

However, I recieve this error:

Unable to cast value to Object 

Position is not a property of Motor6D. You must reference it through C0 or C1

Have you tried using CFrames and Tweening C0 instead?

local ts = game:GetService("TweenService")

local middle = CFrame.new(0, 0, 0)
local down = CFrame.new(0, -2, 0)

local npc = script.Parent
local root = npc:FindFirstChild("HumanoidRootPart")
local torso = npc:FindFirstChild("Torso")

for _, motor in pairs(npc:GetDescendants()) do
	if motor:IsA("Motor6D") then
		ts:Create(motor, TweenInfo.new(1), {C0 = middle}):Play()
	end
end

But I am trying to reference
motor.C0

Not just the motor

{Position = middle} is the mistake

{C0.Position = middle}
or
{C0 = CFrame.new(middle)}

Wow, this worked perfectly, and I see what you did by simply changing
Position
to
C0

Thank you very much

1 Like

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