#Trouble with looping rig parts with ipairs

1 messages · Page 1 of 1 (latest)

ruby fable
#

I am practicing using ipairs and I am trying to loop through each body part of a rig

My code looks like this:

local rig = script.Parent

for index, bodyPart in ipairs(rig:GetChildren()) do
print(bodyPart)
end

I feel like I'm missing something but this code seems to work for models

sullen bison
#

what were you having trouble with exactly

ruby fable
#

Oh sorry

#

It doesn't print the list of body parts

sullen bison
#

probably havent streamed in when the code runs

#

try rig.childadded

#

(you often need both check existing children as well as children added)

#

hence waitforchild is used often for stuff in workspace

sullen bison
#

also is this localscript or server script

ruby fable
nocturne spruce
#

@ruby fable

#

Why ipairs

#

Try the script after removing ipairs

ruby fable
nocturne spruce
#

So now it’s working perfectly?