Try using this app called towelpieroot. It is a modded version of towelroot made to work with the Moto X. I used it and it worked for me, with a locked boot loader.
forum.xda-developers.com/moto-x/themes-apps/root-towelpieroot-motorola-devices-t2825059
Posted via the Android Central App
Unlock your bootloader
http://forum.xda-developers.com/showthread.php?t=2751177
Thanks for the reply, but the only problem I have is I don't want to void my warrantee. Rooting does not void the warrantee, but unlocking the boot loader does. And I saw on Motorola's support site that I could request the unlock code for free. They just stipulate that the warrantee will then be void. So why pay the $45?