I wanted to make a script that would print out the parts of the Player's RigType for fun. When I made my avatar R6, everything worked like a charm, however, when I printed out the contents of the R15 parts, I got this:
HumanoidRootPart (x2)
LeftHand
HumanoidRootPart
LeftHand
LeftLowerArm
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
HumanoidRootPart
LeftHand
LeftLowerArm
LeftUpperArm
RightHand
RightLowerArm
RightUpperArm
UpperTorso
LeftFoot
LeftLowerLeg
LeftUpperLeg
RightFoot
RightLowerLeg
RightUpperLeg
LowerTorso
Head
I apologize for that wall. Anyways, I didn't really know what to do but I still attempted to fix it; I tried to change the ipairs to in pairs on lines 13 and 17 but nothing changed, and I also attempted to check if "r15" was a MeshPart instead of a BasePart but to no avail.
I would appreciate the help! :)
local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local body = {} if hum.RigType == Enum.HumanoidRigType.R6 then for _,r6 in ipairs(char:GetChildren()) do if r6:IsA("BasePart") then table.insert(body,r6) end end elseif hum.RigType == Enum.HumanoidRigType.R15 then for _,r15 in ipairs(char:GetChildren()) do if r15:IsA("BasePart") then table.insert(body,r15) end for _,pr15 in ipairs(body) do print(pr15) end end end
Move your print statement out of the for loop that is looking through the character, like so
elseif hum.RigType == Enum.HumanoidRigType.R15 then for _,r15 in ipairs(char:GetChildren()) do if r15:IsA("BasePart") then table.insert(body,r15) end end for _,pr15 in ipairs(body) do print(pr15) end end