A lot depends on the age of the child.
Generally speaking, the main thing is to be clear in your communication:
Explaining to him or her, what they did was wrong, and why it was wrong.
And why it cannot continue.
You need to tailor your language and explanation to the child's age and ability to understand.
Letting them know why it was wrong, and what the consequences will be, if the behavior continues.