[Noob] Attachment constraint

Hello Everyone,

I am new: -to ScriptSpot and -to Maxscript

And obviously I have an issue.

I want to write a script that create a box for every face of the selected plane. The cube must be the size of the face and each of them must have an attachment constraint with the plane.

And I tried to do this, and..... it didn't work....
So here is the "script" :

rollout firstTry "create box"
(
	spinner taille "Length" type:#integer range:[1,100,1]
	button create "create"
 
	local i = 0
	local att = Attachment()
	on create pressed do
	(
		for obj in ( selection as array ) do
		(
			for faces in obj.selectedFaces do
			(
				myBox = Box length:taille.value width:taille.value height:taille.value
				myBox.position.controller = att
				att.node = $Plane001
				addNewKey att 0f
				theAKey = AttachCtrl.getKey att 1
				theAKey.face = i * 2 + 1
				theAKey.coord = [0.5,0]
			)
		)
	)
)
 
createdialog firstTry

I would really appreciate some help :)