DIAGNOSIS That clicking sound is the drill's electronic trigger switch trying, and failing, to send power to the motor. It's almost always a dead or deeply discharged battery, even if the battery indicator shows a bar or two.
FIX First, swap in a different Ryobi ONE+ 18V battery you know is charged. If the drill runs perfectly with the fresh battery, your original battery is the culprit. Put the dead battery on its charger. If it's a lithium-ion battery, let it charge fully—sometimes they need a good 30-60 minutes on the charger before they'll wake up and show a full charge indicator.
IF THAT DIDN'T WORK If a known-good battery doesn't fix it, the internal trigger switch might have failed. It's a common wear point. You can try spraying a little electronic contact cleaner (not WD-40) into the trigger slot while working it, but often the whole switch assembly needs replacement.
HEADS UP Don't keep pulling the trigger with a clicking, dead battery. It can overheat the switch contacts. If a battery is puffed, swollen, or gets extremely hot on the charger, stop using it—it's a safety hazard.