Chosen Solution
Sound won’t work only on headphones
@hkerry could be a bad speaker, bad connection or a stuck headphone jack. It will help if you can tell us what model your tablet is. At first I would try to clean the headphone jack. Insert and extract the headphones a couple of time in rapid succession, use a few puffs of compressed air to blow in it.