Animation not loading correctly

I am making FPS arms, and I want to make an equip animation for certain tools.

My problem is that when I add the motor6d it doesn’t play correctly, I’m assuming this is because the motor6d is in the incorrect spot when created.

Is there any way to correctly place the motor6d exactly like the animation?

Here’s the line of code that adds the motor6d:

function changeitem()
	if olditem then
		olditem.Parent = rs
		grip:ClearAllChildren()
	end

	local item1 = items[num]
	if item1:FindFirstChild("equipanim") then
		local anim = item1.equipanim
		local anim1 = rig.Humanoid:LoadAnimation(anim)
		anim1:Play()
	end
	olditem = item1
	item1.CFrame = grip.CFrame
	item1.Parent = grip
	local motor = Instance.new("Motor6D")
	motor.Parent = grip
	motor.Part0 = grip
	motor.Part1 = item1
end

Here’s how it’s playing:

Here’s how it should look:

function changeitem()
	if olditem then
		olditem.Parent = rs
		grip:ClearAllChildren()
	end

	local item1 = items[num]
	if item1:FindFirstChild("equipanim") then
		local anim = item1.equipanim
		local anim1 = rig.Humanoid:LoadAnimation(anim)
		anim1:Play()
	end
	olditem = item1
	item1.CFrame = grip.CFrame
	item1.Parent = grip

	local motor = Instance.new("Motor6D")
	motor.Parent = grip
	motor.Part0 = grip
	motor.Part1 = item1
	
	-- Calculate the C0 and C1 based on the current CFrame of grip and item1
	motor.C0 = grip.CFrame:inverse() * grip.CFrame
	motor.C1 = item1.CFrame:inverse() * grip.CFrame
end

this didn’t really do anything… Any other methods?

Probably because the motor 6d can be correlation with something else rather than being in the correct spot or parent try debugging more

1 Like