Connor McLeod, 18, of Balunie Drive, had sentence deferred to be of good behaviour by Sheriff Alastair Carmichael.
McLeod admitted that, by means of a public electronic communication, he sent a message to his former partner which was grossly offensive, indecent or obscene or of menacing character and threatened members of her family with violence on November 19 last year.
The court heard he made the threat during a telephone call to his ex.
Sheriff Carmichael said given McLeod’s age, and that it was his first offence and appeared to be out of character, he would assume it was a one-off and ordered him to be of good behaviour.
Sentence was deferred until April 11 and McLeod was ordained to appear.