Rayguns are a type of fictional directed-energy weapon. They have various alternate names: ray gun, death ray, beam gun, blaster, laser gun, phaser, etc. They are a well-known feature of science fiction; for such stories they typically have the general function of guns. According to the stories, when activated, a raygun emits a ray, typically visible, usually lethal if it hits a human target, often destructive if it hits mechanical objects, with properties and other effects unspecified or varying.
Real-life analogues are electrolasers, electroshock weapons which send current along an electrically conductive laser-induced plasma channel.
A very early example of a raygun is the Heat-Ray featured in H. G. Wells' novel The War of the Worlds (1898). Science fiction during the 1920s described death rays. Early science fiction often described or depicted raygun beams making bright light and loud noise like lightning or large electric arcs. Nikola Tesla's attempts at developing directed-energy weapons encouraged the imagination of many writers.
Soon after the invention of lasers during 1960, such devices became briefly fashionable as a directed-energy weapon for science fiction stories. For instance, characters of the Lost in Space TV series (1965–1968) and of the Star Trek pilot episode "The Cage" (1964) carried handheld laser weapons.
By the late 1960s and 1970s, as the laser's limits as a weapon became evident, rayguns were dubbed "phasers" (for Star Trek), "blasters" (Star Wars), "pulse rifles", "plasma rifles" and so forth.