IK Fk snap button

I am trying to create a Ik to FK snap button as a custom attribute. The rig I'm using has a spinner.

I want this button to:

1: Match the trasformation of Bone001 and Bone006
2: Match the value of my spinner (from-90 to 90) to the equivalent in degrees from brom the y axis of Bone004.

Here is the script.

ca=attributes foottest
(parameters params rollout:testrollout
testSpin type:#float ui: testspinsp
rollout testrollout "Snap test"
spinner testspinsp "spin" range:[-90,90,0]
button buttontest "Test Button"
on button buttontest pressed do
custattributes.add $.modifiers[1] ca

Right now it's making the spinner and the button but the button doesn't do anything. I'm somewhat new at maxscriptingand any help is greatly aprciated.