How to connect tool to Fake Arms?

I made some fake arms for my game, but when I equip a tool and move my camera up the tool doesn’t move up with the arms. I’ve tried welding the tools handle to the fake arms but It didn’t work. Here’s my arms script:

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

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

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

Unfortunately, your if your tool is a literal “tool” that is put in backpack, it is welded to real character’s hand when equipped. To move it with your arms, you would have to make your real character transparent and the tool invisible to the player in first person. Instead of using equipped tool, which is only visible to other clients, you would have tool model stored in for example ReplicatedStorage. Two different options would open then. You could clone your tool from ReplicatedStorage and connect it with your view model by creating new joint each time the tool is equipped, while taking care of proper hand placement (which can be automatized). Another solution would be welding view model and the tool’s handle manually. You would then “parent” your tool to the view model. Both solutions work, all of this can also be animated, if rigged properly (if using Roblox built-in animator, don’t forget to insert a humanoid).

Now, view model is attached to the camera.
The key is in separating player’s view of the world and other clients’. You do separate adjustments as well as create separate animations.
If you have any further questions, fell free to ask, because I have recently had a similar task.

Generally, games don’t actually use tools and instead go for a custom tool solution, therefore not using tools. They generally weld the weapon model to the character’s right arm, play any holding animations, and like mentioned above, keep the viewmodel stuff separate from what is seen externally.

https://devforum.roblox.com/t/the-first-person-element-of-a-first-person-shooter/160434
https://devforum.roblox.com/t/making-an-fps-framework-2020-edition/503318

These are good references for getting started

2 Likes

Hello, can I see how did you try to weld tool to fake arms?

I tried both these scripts.

local weld = Instance.new("Weld")
weld.C0 = handle
weld.C1 = viewModel.Torso

local weld = Instance.new("WeldConstraint")
weld.Part0 = handle
weld.Part1 = viewModel.Torso

This script is in the Tool

It makes no sence, you are trying to set weld’s C0 and C1 without welded parts.
If you didn’t get it C0 and C1 is for offsets, you have to set Part0 and Part1 and set weld’s parent in workspace, part and etc.

Never use WeldConstraint, it always breaks when it comes to Vector3 and CFrame manipulationm

I parented the weld to the viewModel but it still doesnt work

But did you set Part0 and Part1?

I used a normal weld, not a weld constraint

You still need to asign Part0 and Part1. C0 and C1 are CFrame offsets.

Ok, i just did that but when i equip the weapon I teleport into the void. Torsos anchored and CanCollide is off and they have to be for the fake arms to work. And the Handle of the gun is also unanchored