Trying to make a game but the sword object is glitching when the mouse gets too close

any idea what the problem is?

It’s most likely be the angle between the mouse position and the sprite being too tight.

What you could try, instead of using sword.Angle(), use player.AngleToPosition(MouseX(), MouseY())