The ray gun had been apart of the series since the original game on N64. It’s original to the series, so it didn’t appear in a previous Nintendo game.
Though it has changed since the first few games. In Ultimate, its form is pretty much the same as Smash 4. Has that “laser tag” look rather than the sci-fi movie look of the original and Melee.
But it still shoots green laser blasts the same. A decent bit of damage and a pretty long range.
Though its a weapon that’s easily countered and dodged. Most energy-based attacks can stop a shot in its tracks. While not my favorite item, I do find it useful, It can often scare an opponent into keeping their distance.