Revision Difference
Entity:EmitSound#515759
<function name="EmitSound" parent="Entity" type="classfunc">⤶
<description>⤶
Plays a sound on an entity. If run clientside, the sound will only be heard locally.⤶
⤶
If used on a player or NPC character with the mouth rigged, the character will "lip-sync". This does not work with all sound files.⤶
⤶
It is recommended to use sound scripts ( see <page>sound.Add</page> ) over direct file paths. This will allow you to use <page>Entity:StopSound</page> to stop the played sound scripts.⤶
⤶
<note>When using this function with weapons, use the <page>Weapon</page> itself as the entity, not its owner!</note>⤶
⤶
<warning>Do not use this for looping sounds with a filepath: see <page>Entity:StopSound</page> for more details.</warning>⤶
⤶
<bug issue="2651">This does not respond to <page>Global.SuppressHostEvents</page>.</bug>⤶
</description>⤶
<realm>Shared</realm>⤶
<args>⤶
<arg name="soundName" type="string">The name of the sound to be played.
<warning>The string will cannot have whitespace at the start or end. You can remove this with <page>string.Trim</page>.</warning></arg>⤶
<arg name="soundLevel" type="number" default="75">A modifier for the distance this sound will reach, acceptable range is 0 to 511. 100 means no adjustment to the level. See <page>SNDLVL</page>

Will not work if a [sound script](https://developer.valvesoftware.com/wiki/Soundscripts) is used.</arg>⤶
<arg name="pitchPercent" type="number" default="100">The pitch applied to the sound. The acceptable range is from 0 to 255. 100 means the pitch is not changed.</arg>⤶
<arg name="volume" type="number" default="1">The volume, from 0 to 1.</arg>⤶
<arg name="channel" type="number" default="CHAN_AUTO, CHAN_WEAPON for weapons">The sound channel, see <page>CHAN</page>.

Will not work if a [sound script](https://developer.valvesoftware.com/wiki/Soundscripts) is used.</arg>⤶
</args>⤶
</function>⤶
⤶
<example>⤶
<description>Plays sound from the first player on the server.</description>⤶
<code>⤶
Entity(1):EmitSound( "garrysmod/save_load1.wav", 75, 100, 1, CHAN_AUTO ) -- Same as below⤶
Entity(1):EmitSound( "garrysmod/save_load1.wav" ) -- You can remove the arguments that have default values.⤶
⤶
Entity(1):EmitSound( "Weapon_AR2.Single" )⤶
</code>⤶
⤶
</example>