To get the ray gun, you'll want to head to the mission called "Little Resistance."
During that mission, look for puddles on the ground and step on them. Doing so causes lions to rise up, which is tied to obtaining the ray gun. So keep an eye out for those puddles and you'll be on your way to grabbing the weapon.