From the Super Mario Wiki
Ads keep the MarioWiki independent and free :)
In Super Smash Bros. for Nintendo 3DS / Wii U, a Starman appears as an Assist Trophy. Once summoned, the Starman will proceed to teleport around the stage. After it teleports, the Starman stops in its place, glows, and attacks using either PK Beam γ or PK Beam Ω. Getting hit by one of these attacks will cause moderate damage and the player will be momentarily stunned. The beams act like energy projectiles, so they can be absorbed or reflected. If the opponents cause enough damage to the Starman while it's still active, the Starman will be defeated, displaying both the "SMAAAASH!" text and sound effect from EarthBound before disappearing prematurely.
Starmen also appear as Smash Run enemies solely in Super Smash Bros. for Nintendo 3DS. They function the same way as their assist trophy counterparts. However, if the player reflects one of the Starmen's beams back at it, it will be instantly defeated, displaying the "SMAAAASH!" text as well.
Super Smash Bros. Melee
Super Smash Bros. for Nintendo 3DS / Wii U