2000 hyundai shift

I have a 2000 Hyundai elantra. On occasion, the car will not shift into gear. Usually I turn the car off and then it shifts. This problem is occuring more frequently. I took the car to the dealer 4 times. Once they replaced the brake/shift sensor. Once they changed the shift release servo. Still have problem. Help