Inverting location of an object based on pivot?

Hello! I’m kinda new to game developing and I was looking to do a simple topdown shooter just to learn some core elements of Unity2D. I’m looking to do a melee attack, just like the video linked (Btw the guys developing this game are awesome!) :

I know how to program the sword and the melee part, but I just don’t know how they invert the position of the sword after each attack. Can anyone help me with that? Thanks!

Maybe you could show the code so that I can help you?

change scale and rotation of the sword