It needs to be part of good writing. Too many people use profanity thinking it's a cheap technique for adding impact to dialogue (I argue that character animations would be better for adding impact to dialogue), but that kind of usage is rather juvenile. It's usually accompanied with length elongations such as dialogue written as: "Shiiiiiiiit!!!!" rather than just "Shit!".
Using something like "!@$%&*" might be better than using actual profanity as it leaves the job of filling in the profanity to the player, who will have their own ideas of the character's mannerisms (using a specific piece of profanity might betray the player's personal ideas).
If a character is animated to drop to their knees and punch the ground, with sound effects, and the animation ends with their head dropped low then I would be comfortable with a speech balloon popping out of them with just "Shit..." - all the emotion has been portrayed and the player has been given good justification (and in someways, forewarning) for the profanity.
Compare this to a dialogue of: "I couldn't save them...Shit..." and you can see there isn't enough emotion there, so the writer might be tempted to cheat this with lazy, bad writing by adding more profanity thinking that adds emotion with something like: "I couldn't save them...Shit, shit shit shit...".
Using softer language, such as bloody/sod/git/bugger, may be better - but it still deserves good writing. Unfortunately these examples come with come colloquial/cultural connotations so if I were to read these words in dialogue I'd imagine the character being of British culture and I'd expect all their dialogue to follow the correct expectations for that. If they start talking about side-walks, trash and having a sore fanny then I'd feel like my expectations of this character have been betrayed due to awful/lazy writing. Might be safer to avoid profanity that has connotations of other cultures that you might not be confident to write for.
The amount of RPG Maker games I've dialogue-mashed through only to spot the odd "fuck" is crazy. The culprits usually seem to be themed around modern teen-drama, so it's clear that the writer has the assumption that because teens swear quite regularly and casually (like, who doesn't) that it translates well to text dialogue and helps fill in the gap of "these are teenagers" - it doesn't as we, as players, are not absorbed in the moment like a teen would be and game dialogue is very much nothing like actual people talking.
Basically swearing is juvenile, don't do it if you're not a good writer - 99% of RPG Maker developers are not good writers and I am yet to find an MV game that I can say - with confidence - has good dialogue writing. So don't make things hard for yourself by using profanity.