Creating Groups for Joints and Snapping Pivots in Maya

So Im trying to loop through the finger joints of my rig, create a group node for each finger joint and snap their pivots to the joints. Here is what I have so far. It needs work:

`FJoints =“L_R*”, type=“joint”)
for jnt in FJoints:
joint_position = cmds.xform(jnt, q=True, ws=True, t=True)
groups = em=True, name=‘null1’ )
cmds.MatchTransform(groups, joint_position)’

Use command (not runtime command):

cmds.matchTransform()  # not cmds.MatchTransform()

And second argument must also be an object, rather than object’s position.
So, in your code it should be jnt (joint), not joint_position:

cmds.matchTransform(groups, jnt)  # not cmds.MatchTransform(groups, joint_position)

There are additional flags that you could use with this command, depending on what you actually need to match (pivots, position, rotation, scale, etc.), so you might wanna take a look at it’s docs.

P.S. “L_R” seems like rather strange prefix…
If intention was to list left and right fingers’ joints, which are named something like “L_Finger1”, “L_Finger2”, “R_Finger1”, "R_Finger2’, or in similar manner, first line of your code won’t find anything (or will find joints named “L_Ring1”, “L_Ring2”, if they exist, because these names start with “L_R”), so you won’t enter the loop.

Probably you meant something like:

FJoints ='L_*', type='joint')  # list joints starting with "L_" (left side)
FJoints.extend('R_*', type='joint'))  # add to the list joints starting with "R_" (right side)