Hi. I just bought a house and have so much to learn. When I flush the toilet, sometimes the tank doesn't fill up with water and sometimes it does. It seems to happen every other flush.

Can anyone help me to determine which part I need to buy?

Thank you,