If you have a fluidmaster and it turns on for a few seconds and you are sure no water is leaking from the tank, then all you need it one of these
Fluidmaster seal
A quarter turn on the black top and it comes off revealing that seal. It's a common issue and a quick fix. The hardest part is getting to the shutoff valve to cut off water to the toilet