Actions speak louder than words.
The worst thing a writer can do is write something out of character. Unless there’s a purpose to the behavior, be careful.
Think about the backstory you gave your character. Think about their morals and values. What has been displayed so far in your story?
These answers will affect the choices your character makes.
A character who abides by the law won’t suddenly rob a bank – but what could make them?
There’s an episode of Black Mirror called Shut Up and Dance, and while it’s incredibly fucked up (as that whole show is), it’s an interesting look at “out of character” behavior. An unseen antagonist is forcing the hand of multiple people, because their morals have been compromised.
Imagine how that episode would change if a character had no morals.
Imagine the same for your story. Do the actions of your characters make sense? If you can’t tell me exactly why they’re doing what they’re doing, you need to either dig deeper, or consider that the action isn’t in their character.