Converting R6 Torso Finder to R15

How would I change a script that searches for torso’s to detect R15 torso parts?


Here are the lines I want to change.

1 Like

You could find out they body type by getting Humanoid.Rigtype, or by checking for Upper Torso and Lower Torso in the character.



local characterChildren = character:GetChildren()

for i=1, #characterChildren do
local child = characterChildren[i]
local i = 0 
if child.Name == "Upper Torso" 
i = i + 1
elseif child.Name == "Lower Torso"
i = i + 1
end

if i == 2 then
--r15 torso
end
end
1 Like

Search for UpperTorso but to make the script work for both R15 and R6 search for HuminoidRootPart

2 Likes

But how would I implement that into this script? I’m kind of new to scripting, so I’m not sure how.

You have to rework that script to change the R6 parts to R15 parts

How do I do that? What do I change or add to make them detect R15?

Change any reference to R6 parts with R15 parts

The torso parts that exist in both rigs are:

  • R6: Torso
  • R15: UpperTorso

So you could just simply do local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")

Or for a less work torso rig check, this works too (just gets rid of FindFirstChild so you always know what the name of the torso will be assuming rig type won’t change suddenly):

local rigTorsoName = humanoid.RigType == "R6" and "Torso" or "UpperTorso"

local torso = character[rigTorsoName]

You can use HumanoidRootPart, which is in both R6 and R15 characters, instead of Torso/UpperTorso.