Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
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!

Ad

Answer this question