From the Super Mario Wiki
Shroob Blaster or more commonly known as Shroob Rayguns are common weapons used by the Shroobs during the events of Mario & Luigi: Partners in Time. They would shoot out a small ball of energy at the brothers. There were also large versions mounted on Shroob UFOs. They are the Shroobs' weapon of choice when battling Mario or Luigi.
In the Mini-Boss battle against the three Shroobs, they would walk up and use their Shroob Blaster attack. If they twirl around, they will shoot Luigi, but if a small shine appears on the Shroob, they will blast Mario. However, the battle is impossible to win, as in 3 turns, a Shroob UFO will send a large blast at the Mario Bros., instantly defeating them. However, Baby Bowser shot them down with a giant Spiked Ball, and the Baby Mario Bros. continued the fight against two Shroobs. They still attacked the same way.
Numerous Shroob-like creatures, like the Dr. Shroob and Guardian Shroob, use the exact same attack. However, a Guardian Shroob will shoot much quicker, and they will mainly attack with a partner aiming at both of the Mario Bros.