Attempting to create an object that rotates around the player, pointing at the mouse

I’m attempting to make a top-down shooter, but I’m very new to this, literally just today. I’m trying to make it so a gun will spin around the player while pointing towards the mouse cursor. Now by just messing around I’ve already gotten the first half of having a gun be attached to & rotate around the player with the “Put The Object Around Another” script, but I can’t find a variable that just lets it spin in the direction of the mouse cursor. To clarify, I’m not trying to get it to spin on it’s axis, I’m trying to get it to spin around the player correctly. It’s hard to describe so I drew a visual aid in MS Paint.


Like this ^

Hi!
You just need to add an event to rotate the Object towards the angle between the Player and the cursor (screenshot below).


Also if your object has an irregular shape I recommend you flip the object vertically when its X position is lower than the Players X position (screenshot below), also It will look better if the points of your objects are centered (screenshot below).


Thank you so much! This works really well except now I has a new problem. If the mouse cursor gets too close to the player the gun will start phasing between to positions trying to point at the mouse. What’s funny is that I actually can’t seem to get a screenshot of this happening because the screenshot just takes a look of one frame, & it’s flipping every frame, despite looking like it’s in two positions

Try using angle between the player and the gun.