my right rear turn signal does not work on my 2000 gmc sonoma on 2000 GMC Sonoma

I tried to replace bulb but when i did it didnot correct the problem. Also every now and then it will start working again for awhile then stop again.

2 answers
Check the socket for corrosin & also check the wires to the bulb.
I had this prob one time and it was the plastic piece that the bulb plugs into. It was only like $20 at advanced auto