Referencing the body parts of a roblox player

Ight I am sorry for how stupid I may sound but I am getting kinda desperate and I literally can see no sources regarding this.

  1. How to get a body part, like the left leg or right arm of a roblox player

  2. I am somehow literally unable to find this anywhere, if you could, could you link the direct source of where you found it in the roblox documentation.

  3. What I tried to do was to reference it like the code below (LocalScript)

local players = game:GetService("Players").LocalPlayer
local character = players.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

print(humanoid:FindFirstChild("LeftArm")

it outputs

nil

Please, how does one reference a particular body part in a player.

2 Likes

The Characters Limbs have spaces in them, so you would need to do this:

print(character:FindFirstChild("Left Arm"))
print(character:FindFirstChild("Right Arm"))
print(character:FindFirstChild("Left Leg"))
print(character:FindFirstChild("Right Leg"))
-- or:
print(character["Left Arm"])
print(character["Right Arm"])
print(character["Left Leg"])
print(character["Right Leg"])

if you are trying to get the Motor6D for the limb, it would be Shoulder instead of Arm, and Hip instead of Leg, which are located inside the Torso depending on the RigType, which I’m assuming is R6

Edit: you were also trying to get the Limbs from the Humanoid instead of the Character model

4 Likes

Oh my days, this response time was faster than my dad with the milk, tysm

3 Likes

It depends on the model of the humanoid. Most common humanoid models are R6(original old blocky avatar) and R15(avatar with more joins in hands and legs, like a human). For this example, let’s use the humanoid right arm. To fetch the right arm for R6 you need to do:

local rightArm = model:FindFirstChild("Right Arm")

but for R15, the default setting for Roblox games the right arm is made out of 3 parts(same for left arm and legs), so you have to do:

local rightArmParts = {model.RightUpperArm, model.RightLowerArm, model.RightHand}

In general the names of the body parts of each character type are the following:

local R6 = {"Torso", "Left Leg", "Right Leg", "Left Arm", "Right Arm", "Head"}
local R15 = {"LeftHand", "LeftLowerArm", "LeftUpperArm", "RightHand", "RightLowerArm", "RightUpperArm", "UpperTorso", "LeftFoot", "LeftLowerLeg", "LeftUpperLeg", "RightFoot", "RightLowerLeg", "RightUpperLeg", "LowerTorso", "Head"}

and you can fetch the character parts with the following function:

function FetchCharacterParts(character: Model): {BasePart}
	local parts = {} 
	for _, obj in pairs(character:GetChildren()) do 
		--you can include the root part if you like
		if obj:IsA("BasePart") and obj.Name ~= "HumanoidRootPart" then 
			table.insert(parts, obj)
		end
	end
	return parts 
end

Generally, to examine how to avatar system works you can simply open the explorer or import dummies from Studio AVATAR tab -> Rig Builder

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.