How to make weapon orbitiong player and follow the camera at the same time like shown in video below?

I’m trying to make some neon style rougue-like game with a sphere that represents a main character… And i’m really stuck with this gun issue cause when i’m making it a camera child object…well…it’s not working properly. How can i make it orbiting player, changing rotation of it when player moves to certain direction and take control of it with mouse any time? Seems like it’s really comlicated question, but still…
Here is the video btw : Remaking My First Game! | Devlog #1 - YouTube

Sorry… I solved it already.
Just created an empty GameUbject and atteched the gun to it and added script to this object as well.

Here the code if someone would need it

public class WEAPON_FLOW : MonoBehaviour
{
   public Transform followSphere;

   public Transform CamTransform;
     
 void FixedUpdate () {
     transform.position = followSphere.transform.position;

     transform.rotation = CamTransform.transform.rotation;
    
 }
}