A self-described "dirty old man" tried to arrange secret meetings with an underage girl during online chats, a court was told.
Laurence McMillan sent the 15-year-old a series of "sexual and inappropriate" messages via a social media messaging service.
The 40-year-old told the teenager to delete the messages and "remember to keep our secret".
At Dundee Sheriff Court he was sentenced to three years supervision.
The court was told that McMillan contacted the girl at 05:00 on 19 December last year before sending her numerous messages later that day.
He began to use inappropriate language, asking the girl if she was in bed and about her sexual interests.
He then told the girl: "Don't tell anyone I'm talking to you."
When asked why he replied: "Because I'm a dirty old man."
Sex offenders register
McMillan then told the girl to delete the messages after saying "remember to keep our secret" and "I will keep my thoughts to myself."
Depute fiscal John Adams told the court: "At this point the child became uncomfortable with the exchange.
"She told her mother about the messages and police were contacted."
McMillan, from Dundee, admitted a charge under the Sexual Offences (Scotland) Act.
Defence solicitor Gary McIlravey said: "There is little I can add to the narrative - the court has full reports."
Sheriff Simon Collins QC imposed a community payback order with a requirement for McMillan to take part in a sex offenders groupwork programme.
He also placed McMillan on the sex offenders register for three years.