Adding directions to the map

Is there any way to show directions on a map? I tried using the polyline code but that just shows a straight line and I need directions that you can follow. Maybe there’s just a way to link it to google maps? Like some kind of code I can add that will just take the user to the actual google maps app and put in directions.