Is it possible to attach an Actor to a characters's specific component?

so I’ve got a GunRifle_BP and i want to attach it to the main character’s Camera Component so that the gun moves with the camera and not the root. is there a way to do this?

oops nevermind guys i actually figured it out :smiley:

Rifle->AttachToComponent(CameraFirst, FAttachmentTransformRules::KeepRelativeTransform);