Why do the limbs all condense in the camerapart?

uh so basically
image
all my limbs just got thrown into one place
not sure why, probably a dumb question idk
heres the code

local Player = game:GetService("Players").LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
Character.Archivable = true
repeat task.wait() until game:IsLoaded()
local sf = string.find

local viewmodel = Instance.new("Model")
viewmodel.Name = "ViewModel"

local ClonedChar = Character:Clone()

for Num, Part in ipairs(ClonedChar:GetChildren()) do
	local name = Part.Name:lower()
	
	if not sf(name, "hand") and not sf(name, "arm") and not sf(name, "head") then
		if not Part:IsA("Humanoid") and not Part:IsA("Shirt") then
			Part:Destroy()
		elseif Part:IsA("Humanoid") then
			Part.Parent = viewmodel
			for i, v in ipairs(Part:GetChildren()) do
				if not v:IsA("Animator") then v:Destroy()end
			end
		else
			Part.Parent = viewmodel
		end
	else
		if not Part:IsA("MeshPart") then
			Part:Destroy()
		else
			Part.Anchored = true
			Part:ClearAllChildren()
			Part.Parent = viewmodel
		end
	end
end
ClonedChar:Destroy()
viewmodel.Parent = workspace.Camera

local CameraPart = Instance.new("Part"); CameraPart.Name = "CameraPart"
CameraPart.Anchored = true
CameraPart.CanCollide = false
CameraPart.Size = Vector3.new(.75,.75,.75)
CameraPart.Parent = viewmodel
CameraPart.CFrame = viewmodel:WaitForChild("Head").CFrame
viewmodel:WaitForChild("Head"):Destroy()

local LeftHand = viewmodel:WaitForChild("LeftHand")
local LeftLowerArm = viewmodel:WaitForChild("LeftLowerArm")
local LeftUpperArm = viewmodel:WaitForChild("LeftUpperArm")

local RightHand = viewmodel:WaitForChild("RightHand")
local RightLowerArm = viewmodel:WaitForChild("RightLowerArm")
local RightUpperArm = viewmodel:WaitForChild("RightUpperArm")

local Motor1 = Instance.new("Motor6D")
local Motor2 = Instance.new("Motor6D")
local Motor3 = Instance.new("Motor6D")
local Motor4 = Instance.new("Motor6D")
local Motor5 = Instance.new("Motor6D")
local Motor6 = Instance.new("Motor6D")

-- Left To Camera
Motor1.Part0 = LeftHand; Motor1.Part1 = LeftLowerArm
Motor1.Parent = LeftLowerArm
Motor2.Part0 = LeftLowerArm; Motor2.Part1 = LeftUpperArm
Motor2.Parent = LeftUpperArm
Motor3.Part0 = LeftUpperArm; Motor3.Part1 = CameraPart
Motor3.Parent = CameraPart

-- Right To Camera
Motor4.Part0 = RightHand; Motor4.Part1 = RightLowerArm
Motor4.Parent = RightUpperArm
Motor5.Part0 = RightLowerArm; Motor5.Part1 = RightUpperArm
Motor5.Parent = RightUpperArm
Motor6.Part0 = RightUpperArm; Motor6.Part1 = CameraPart
Motor6.Parent = CameraPart

-- Unanchor limbs
LeftHand.Anchored = false
LeftLowerArm.Anchored = false
LeftUpperArm.Anchored = false
RightHand.Anchored = false
RightLowerArm.Anchored = false
RightUpperArm.Anchored = false


1 Like

The Motor6Ds mess with the origin position of their attached parts, which is why it looks like this.

What are you trying to do here exactly?

1 Like

add motors to the limbs so i can animate the limbs for a viewmodel :smiley: :+1:

I would recommend using a rigging plugin instead. It greatly simplifies the rigging process so it’s easier to get the limbs to attach how you want them to.

Check this out:
https://create.roblox.com/marketplace/asset/2908380847/Rig-Editor?pageNumber=1&pagePosition=0&keyword=rigging

I’m still confused by your code though. It seems you could just easily use the cloned character directly without having to re-rig or modify any of its limbs.

1 Like

now thinking of this, it may be better than what im trying to attempt

1 Like

Alright, im moving over to the method you suggested

Although is there a way to keep the arms in the position after the unanchor?

because im still trying to put motor6d in the camera part and “weld” (idk the name for the motors) the upper shoulders or whatever they are called by roblox to the camera part