Melatonin

Trouble sleeping.. on my melatonin bottle it says don't take if pregnant . But I've heard others say it's safe?