How to make simple viewport arms

I’ve been trying for along time just to make some FPS arms that I can weld to a weapon. Heres some scripts I’ve used:

Script 1:

-- Variables
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local runService = game:GetService("RunService")
local viewModel = game.ReplicatedStorage.viewModel:Clone()
local viewModelRoot = viewModel.PrimaryPart

viewModel.Parent = workspace

-- RenderStepped
runService.RenderStepped:Connect(function ()
	viewModelRoot.CFrame = workspace.CurrentCamera.CFrame *, -2, 0)

	viewModel.Torso["Left Shoulder"].Transform = character.Torso["Left Shoulder"].Transform
	viewModel.Torso["Right Shoulder"].Transform = character.Torso["Right Shoulder"].Transform

Script 1 isnt working because:
This is how I want it to be: image
But when I insert the motor6ds to connect the arms to the torso, this happens:
And when ever i try to move the arms back the motor6ds destroy

Script 2:

local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local camera = workspace.Camera
local currentCamera = workspace.CurrentCamera

local viewModel = replicatedStorage:WaitForChild("viewModel"):Clone()
local humanoid = viewModel:FindFirstChild("Humanoid")

local motorCheck = script:WaitForChild("MotorCheck").Value
local motor6D = viewModel:FindFirstChild("Motor6DRight")

	if key.KeyCode == Enum.KeyCode.E then
			viewModel:SetPrimaryPartCFrame(currentCamera.CFrame *, -1, 0))
		viewModel.Parent = camera
		motor6D.C0 = viewModel:WaitForChild("Right Arm").CFrame
		motor6D.C1 = viewModel:WaitForChild("Handle").CFrame
		motor6D.Part0 = viewModel:WaitForChild("Right Arm")
		motor6D.Part1 = viewModel:WaitForChild("Handle")
		if motorCheck == true then
			motor6D.Part0 = viewModel:WaitForChild("Right Arm")
			motor6D.Part1 = viewModel:WaitForChild("Handle")
		local animationId = 6239823515
		local animation ="Animation")
		animation.AnimationId = ""..animationId
		local loadAnimation = humanoid:LoadAnimation(animation)

When I load in with this script, the arms just fall through the world.
Heres what the 2nd viewportModel looks like

Any help is appreciated. Is there a better way I can do this?

1 Like

This is probably happening because C0 and C1 are offsets not positions. So when you set them using the CFrame of the parts that haven’t been added as a direct descendant of the workspace and a part the CFrame is blank and C0 and C1 are both blank so the parts simply act as though you just added the Motor6D. Try seting them to half the size of each part relative to the pats’ offset directions. For example, to set the right arm’s offset you would do

C0 =, 0, 0)