To make it work for attachments, go to type specific settings and choose the places for attachments to show up. Next, export that gun model. Then go to the gun config and enable it to take attachments in those slots. Make sure accept all attachments is on, along with the allowattachmenttype options, like AllowBarrelAttachments for example. You can change that later once you make the attachment config, and use the shortname of the attachment for the AllowAttachments option.
To make one, make an attachment model with the gun model type with all the parts set to Attachment - (Whatever kind of attachment it is goes here) for the model part. Next, go to export as flans mod model, choose export model as, and choose the right one for this model. Then make the attachment config. You will have to do it manually in a text editor though, for toolbox will not export those changes for some reason. Go
for the different config parameters, or just copy a config that's already similar to the attachment your trying to make and change things to suit yours.