Yes children can and do safely take Melatonin at times to help them sleep as long you give the child a correct dose of the Melatonin.
Check with your child's doctor to get a recommendation on the correct dosage of melatonin for your child.
But between 3 to 6 mg of Melatonin is safe for a child to take.