Garry's Mod Wiki

Revision Difference

sound.Play#547072

<function name="Play" parent="sound" type="libraryfunc"> <description> Plays a sound from the specified position in the world. If you want to play a sound without a position, such as a UI sound, use <page>surface.PlaySound</page> instead. </description> <realm>Shared</realm> <args> <arg name="Name" type="string">A string path to the sound.</arg>⤶ <arg name="Pos" type="Vector">A vector describing where the sound should play.</arg>⤶ <arg name="Name" type="string">A path to the sound.⤶ <validate>Does this function support sound scripts?</validate>⤶ This should either be a sound script name (<page>sound.Add</page>) or a file path relative to the `sound/` folder. (Make note that it's not sound**s**)⤶ </arg>⤶ <arg name="Pos" type="Vector">Where the sound should play.</arg>⤶ <arg name="Level" type="number">Sound level in decibels. 75 is normal. Ranges from 20 to 180, where 180 is super loud. This affects how far away the sound will be heard.</arg> <arg name="Pitch" type="number">An integer describing the sound pitch. Range is from 0 to 255. 100 is normal pitch.</arg> <arg name="Volume" type="number">A float ranging from 0-1 describing the output volume of the sound.</arg> <arg name="Pitch" type="number">The sound pitch. Range is from 0 to 255. 100 is normal pitch.</arg> <arg name="Volume" type="number">Output volume of the sound in range 0 to 1.</arg> </args> </function> <example> <description>Plays an explosion sound at the (0, 0, 0) map coordinates.</description> <code>sound.Play( "ambient/explosions/exp1.wav", Vector(0, 0, 0) )</code> </example>