About half the time i drive my car, my speedometer sticks at 0 and my odometer doesnt count any miles. It cant be a fuse because it happens on and off. It kinda sucks cuz i got a ticket last night for 65 in a 55 and i had no idea how fast i was going because my speedometer was stuck at 0

Any ideas how i could fix it?