How come the humanoidrootpart isnt moving?

Trying to create a r15 viewmodel to work with guns, but having some issues setting it up.

One of those issues is that the humanoidrootpart wont move to the camerapart’s CFrame.

Heres the code i currently got

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

local RootPart

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") and not string.find(Part.Name:lower(), "root") 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
		elseif string.find(Part.Name:lower(), "root") then
			RootPart = Part
			Part.Parent = nil
			Part.Size = Vector3.new(.75,.75,.75)
			Part.CanCollide = false
			Part.CanQuery = false
			Part.CanTouch = false
			Part.Transparency = 1
		else
			Part.Parent = viewmodel
		end
	else
		if not Part:IsA("MeshPart") then
			Part:Destroy()
		else
			Part.Anchored = true
			Part.Parent = viewmodel
			for i, v in ipairs(Part:GetChildren()) do
				if not v:IsA("Motor6D") then
					v:Destroy()
				end
			end
		end
	end
end
ClonedChar:Destroy()
viewmodel.Parent = workspace.Camera
local Humanoid = viewmodel:WaitForChild("Humanoid")

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

Humanoid.Parent = nil
RootPart.Parent = viewmodel
RootPart.CFrame = CameraPart.CFrame

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")
Motor1.Parent = RootPart
Motor2.Parent = RootPart
Motor3.Parent = RootPart

Motor1.Part0 = RightUpperArm
Motor1.Part1 = RootPart

Motor2.Part0 = LeftUpperArm
Motor2.Part1 = RootPart

Motor3.Part0 = CameraPart
Motor3.Part1 = RootPart
Humanoid.Parent = viewmodel

move the character, not the humanoidrootpart

do

ViewModel:PivotTo(camerapart.CFrame)

and not

HumanoidRootPart.CFrame = camerapart.CFrame

But moving the humanoidrootparts what im tryna do, im trying to have the rootpart ontop of the camera part. Not exactly move the entire model

the viewmodels’ arms are probably welded to the rootpart, get rid of the welds and it should be fixed
I could be wrong

image
i dont think so, plus pretty sure the :ClearAllChildren() gets rid of the welds

(edit)
Sorry for the long reply, ive been doing some stuff

the easiest way to fix this would be to just remove the humanoid from that model, then weld all baseparts to the HRP. Make sure the HRP is the only thing anchored and use RunService.RenderStepped:Connect(function() to set the cframe of the primary part which should be the HRP on that model
the cframe you are going to set it to should be one from the camera with a forward offset

Then add the humanoid back?, if not then what.

i tried doing that but then all the limbs group togther on the humanoid root part or something idk

Also changed code

oh you may need to weld the parts then remove the humanoid if its something that needs humanoid just leave it but still weld all to mainpart then move