How to make a 2D sidescroller aim weapon 360 degrees with a gamepad?

I’m trying to make a 2D sidescroller shooter game where the player can aim their weapon with the left joystick 360 degrees. I have no idea how to script this and if anyone could help me I’ll gladly appreciate it.

This was my attempt in doing so.