If the laptop screen doesn't work, but it works when connected to an external monitor, then that means it isn't your graphics card/GPU, which is great.
However, it does mean that either the ribbon cable that connects the display to the motherboard, or the display itself, are the issue.
If the laptop is still under warranty, I would contact the manufacturer about a repair/replacement.