Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I check if one of my model's children has a property "Right Arm"?

I'm trying to make a script where it will automatically rename my Rig's joints. This is what I've tried and it doesn't work. Elk is my rig in my workspace (it is a model), and it has a part named Torso in it.

Rig = workspace.Elk
Torso = workspace.Elk.Torso:GetChildren()

for i, v in pairs(Torso) do
	if v.Part1 == ("Right Arm") then
		v.Name = ("Right Shoulder")
	end
end

1 answer

✓ Accepted answer
Rig = workspace.Elk
Torso = workspace.Elk.Torso:GetChildren()

for i,v in pairs(Torso) do
	if v.Part1.Name == "Right Arm" then
		v.Name = "Right Shoulder"
	end
end

You were trying to check if a part was equal to a string value. This script will loop through the Torso checking if any Motors have a Part1 named "Right Arm". I hope this will help you out!

This discussion is preserved as it was. New answers, comments, and votes are closed.