Welcome , sorry to hear about your kid. Can you see if he cut his foot or has something stuck in there? Not sure what would be the best to give him. Hopefully others will respond with ideas for you.
Like Hens and Roos said, you need to make sure that there is no injury that you can see. If it is a sprain/strain then you can give him Banamine, but you would need to get that from a vet or you can give aspirin or ibuprofen as well.
Aspirin is 1 regular aspirin for every 10lbs
Ibuprofen is double human dose.
ETA. If he isn't better in a few days I would seek the advice of a vet.
Generally speaking at any given time I've got at least one goat that has hurt something
We always keep banamine on hand for pain
But mine are always hurting a foot or leg or something and I usually wouldn't give anything in that case
I'd check his foot and see if I saw any type of wound and if I did spray with some antiseptic spray
Make sure there is no hoof rot going on
Something stuck under a curved under part of a hoof or between toes can have them limping instantly.
If there is any swelling or heat in the area, you might have an abscess or puncture, sprain etc.... For an abscess or infection, antibiotics would be appropriate.
Banamine for pain and inflammation would be ideal if you have any.