I mean, how else are you going to deter people from committing sins (which btw have detrimental effects on both the person himself/herself and society as a whole)if not by warning them and mentioning the punishment they're going to receive for doing bad things