Server
Manipulate the sound
Play
This export is a synchronous function, which means that this code returns a soundId to you. And if sound is not created, it returns false
Parameters
source:
number
You can pass -1 for sync
soundId?:
string
If not provided, will be created automatically
url:
string
coords:
vector3
Unlike the client side the coords param is required on the server side
loop?:
boolean
volume?:
number
Override default volume (even if sound profile is enabled)
panner?:
PannerNode
Returns
soundId | false
Play Async
This export does not return the soundId compared to the above. However, it works faster and you can connect the sound directly to an entity or player at startup. Very useful for asset sounds
It should only be used for asset sounds, DO NOT use it for youtube, spotify and soundcloud!
Parameters
source:
number
You can pass -1 for sync
soundId?:
string
If not provided, will be created automatically
url:
string
coords:
vector3
Unlike the client side the coords param is required on the server side
loop?:
boolean
volume?:
number
Override default volume (even if sound profile is enabled)
panner?:
PannerNode
data?:
{ attachEntity: number, attachPlayer: number }
Stop
Parameters
source:
number
soundId:
string
Pause
Parameters
source:
number
soundId:
string
Resume
Parameters
source:
number
soundId:
string
Destroy
Parameters
source:
number
soundId:
string
Destroy All
Attach Entity
Parameters
source:
number
soundId:
string
networkId:
number
Detach Entity
Parameters
source:
number
soundId:
string
Attach To Player
If you are going to attach to a player, you can of course use the attachEntity
. But you should definitely use this. Because if the player gets in the car, the script detects it with this export and filters the sound.
Parameters
source:
number
soundId:
string
playerId:
number
Detach From Player
Parameters
source:
number
soundId:
string
Last updated