You need to find out if the problem is with the transfer case or the front axle.
Put the truck in 4x4, dash light on. Then crawl underneath and see if you can turn the front driveshaft. You shouldn't be able to turn the front shaft. If you can, the problem is t-case related. If you can't turn the shaft, the t-case is engaging correctly and you can move on to the front end.
My guess, since the dash light does come on, is that you have a problem with the locking hubs. Does your truck have automatic or manual hubs? If you have auto hubs and that turns out to be the problem, they can be repaired or replaced, but parts are expensive and they aren't very reliable so your best bet is to switch them out for manual lockouts. If you already have manual hubs, they obviously have to be locked for your 4x4 to work...
Start with the transfer case and go from there. Good luck, let us know what you find.