The dev api says this about sounds … " A sound placed in a BasePart
or an Attachment
will emit its sound from that part’s BasePart.Position
or the attachment’s Attachment.WorldPosition
… A sound is considered “global” if it is not parented to a BasePart
or an Attachment
. In this case, the sound will play at the same volume throughout the entire place."
From that text above, it sounds as though all I need to do is make sure my sound is placed in a basepart or attachment. However I need my sounds to be local, and only audible to a certain client, that is within range of the sound, so I noticed the following text…
" Sound playback is not filtered. If a particular client starts playing a sound, all of the other clients will also play it unless SoundService.RespectFilteringEnabled
is set to true."
So I set SoundService.RespectFilteringEnabled to be true
Then I read …
" While the playback of sounds will replicate, other properties such as the playback speed, pitch, volume, etc. will not replicate. This behavior can be avoided by creating all sounds locally on the client, as instancing sounds will not replicate to the server."
So I made sure my models on the client had their sound object be instanced from a local script
However, when I tested, there was no sound attenuation, it was at a global volume level.
Then I saw this…
" Sounds parented to a BasePart
or Attachment
that are descendants of the Workspace
are considered 3D sounds and their volume whilst playing is dependent on the distance between the client’s sound listener"
So I noticed it says “Workspace” even though my sound objects are parented to baseparts in the ‘local workspace’ (parented to workspace with FE true) it still is at a global sound level, so this makes me think when the text says “Workspace” they really mean “Server Side Workspace”
I would like to also note that I tried to create the sound in Player.Character, and CurrentCamera and still the same results
So, before I try to write for find some sound code (because I would rather use the Roblox one with attenuation and doppler) I decided to ask and see if anyone has been able to get the sounds attenuation (EmmiterSize and MaxDistance) to work from a basepart that is located on the client.
Thank you for your time.