It’s called negative punishment, and is pretty ineffective at eliciting the desired behavior. Positive reinforcement is the only way to spotlight the behavior you want by rewarding it. Punishment is more like learning the shape of a room by stubbing your toes on the walls. You’ll eventually get it but only after trying everything else you can think of.
"Negative punishment is taking something pleasurable away to decrease the behavior. An example of negative punishment is taking away a toy if your child hits their sibling with it."