Traya is one of the toughest bosses in Knights of the Old Republic II, so it's no surprise players struggle with her.
One approach that works well is playing on the dark side and using Force Crush — it's effective against Nihilus and Sion, and it works on Traya too. The key is timing: when she draws her lightsabers and becomes vulnerable, that's your moment to strike, since Force Crush won't affect her while she's in her machine-like form.