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

How to loop through all parts of R15 Rig?

Asked by 6 years ago

I have been using R6 for some time and now want to make things work with R15. I have a char script that chars the parts of a R6 rig but I wrote out all of the parts of the rig. In R15 there are quite a few parts to call on. Is there a way to have the script find the rig get all of its parts and char them without me having to define each part of the R15 Rig?

Thank you for the help.

0
You could use a for loop, and check out name if they have "Torso", 'Leg', or 'Arm' in the name via a function like `string.match`. TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You can get all the parts of an R15 character by using some conditional statements and a for loop. Here's an example :

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        for i,v in pairs(char:GetChildren()) do --Gets children of character
            if v:IsA('Part') or v:IsA('MeshPart') then --Checks if object is a part or meshpart
                print(v) --Prints name of part
            end
        end
    end)
end)

Basically when a player spawns, the script checks if any of the objects in the character are parts or meshparts, then it prints the parts or meshparts.

Also I don't get what you mean by "char them". Do you mean char them like packages?

Hope this helped anyways!

0
Yes char like a package or change the colors of the rig,  Thank you for your help this answers my question :) . Zeustice 41 — 6y
Ad

Answer this question