deterrent
Something that makes people not want to do something bad.
A deterrent is something that discourages people from doing something by making them think about the unpleasant consequences. The word comes from a Latin root meaning “to frighten away.”
Think of how a home security system works. The cameras and alarm signs act as deterrents because burglars see them and decide to move along rather than risk getting caught. The security system might never actually catch anyone, but it still works by changing their decision before they act.
Schools use deterrents too. The possibility of detention deters students from breaking rules. The threat of losing recess time deters students from talking during quiet work. These consequences don't have to happen to work: just knowing they might happen is often enough to change behavior.
In your own life, you probably encounter deterrents regularly. The risk of getting grounded might deter you from sneaking extra screen time. The memory of a stomachache might deter you from eating too much candy. A deterrent works by making you pause and think: “Is this worth the consequences?”
Countries use deterrents in more serious ways too. Nations maintain strong militaries partly as deterrents, hoping other countries will think twice before attacking. The goal isn't necessarily to fight, but to prevent fights from starting in the first place by making the cost seem too high.