Two Fylde school boys were asked to send naked photos to a stranger on a gaming website.
The 14-year-olds had been asked for the images of themselves in exchange for a gaming code.
However, the potential abuse of the boys, who cannot be identified, was spotted by teachers taking part in course set up to prevent grooming.
The course was run by the charity SAFE which was created to prevent grooming, child sexual exploitation and human trafficking.
The course provides materials for teachers to use in their classes – highlighting the dangers of grooming and how young people can protect themselves.
The boys, understanding the seriousness of the approach, then went to their teacher for help.
The school was then able to take the steps needed to keep the boys safe and give them the right support and well as contacting the police.
SAFE chief John Piekos, a former senior police officer, said: “All young people can be vulnerable to exploitation and we believe the best way to tackle it is through education.
“Our work helps young people recognise any attempts to target them or their friends, what to do about it and how to get help.
“The young people concerned saw that these requests were dangerous and the beginnings of something sinister. They went to their teacher for help, who then took appropriate action.”
A teacher from the school, who cannot be named for legal reasons, said: “Fourteen teachers took part, along with their pupils, in this course.”
Mr Piekos added: “It helps for young people to know there are trusted adults who they can turn to.
It’s important that they can voice any concerns they have about a friendship or relationship at an early stage.”