If its something you never made before, looking up resources about it can help. I’m not saying copy code, but look for the logic behind the system, explaining how it works, and re-creating it
This is something you don’t need to be able to do, websites like this or stackoverflow exist for a reason. There’s nothing wrong with needing to research a topic or get a little help, but that doesn’t mean copying entire scripts.
Open source modules also exist for a reason, and there’s nothing wrong with using one of those if it works good. Why re-invent the wheel ya know?
Google is your best friend when coding, even with years of experience I still google quite often for the littlest things.