Skip to main content

Speaker.CreatePlayerAttached

Creates a speaker attached to a player to play audio through.

Syntax

Speaker.CreatePlayerAttached @player_to_attach "speaker_name" volume? min_distance? max_distance? is_stereo? @target_players? update_target_players?

Arguments

NameRequiredTypeDescription
player to attachYesPlayer value e.g. @player, with EXACTLY 1 player.
speaker nameYesAny text e.g. "Hello, World!"
volumeNoA number bigger or equal 0%The volume of the audio.
min distanceNoA number bigger or equal 0The minimum distance for full-volume audio.
max distanceNoA number bigger or equal 0The maximum audible distance for the audio.
is stereoNobool (true or false) valueWhether the audio will be 3D.
target playersNoPlayer variable (e.g. @all, @classDPlayers)only these players will hear the audio.
update target playersNobool (true or false) valueWhether to constantly refresh the value provided in the 'target players' argument.

Possible errors

  • Player does not have a model to attach a speaker to.

On a running server

Use serhelp Speaker.CreatePlayerAttached to inspect the reference generated by your installed SER version.