Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make music/sound decrease in volume as you move away from it?

Asked by 3 years ago

I want there to be music playing in a specific area, but have it so once you move away from it the volume decreases just like a regular 3D Sound. However, if I just put the sound on a BasePart, then Roblox does that surround sound effect where it switches between speakers to give the direction of the audio, but that's kind of annoying and headache-inducing for constant sounds.

I don't know if what I need is something that needs to be scripted or if it's properties I can change. I'm trying to get my music to play like it's parented to the Camera/Workspace/whatever where it plays in both speakers the same volume, and walking out of the area makes the music slowly go away and then disappear altogether,

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

There's a sound property called sound.RollOffMode you can change that makes it fade as you go away from it.

Taken from the wiki, the different types of fading are:

  • Inverse: Volume attenuates from Sound.EmitterSize in an inverse manner

  • InverseTapered: A hybrid model. Follows the Inverse model when close to Sound.EmitterSize and the Linear Square model when close to Sound.MaxDistance.

  • Linear: Volume attenuates between Sound.EmitterSize and Sound.MaxDistance with a linear relationship.

  • LinearSquare: Volume attenuates between Sound.EmitterSize and Sound.MaxDistance with a linear squared relationship

https://developer.roblox.com/en-us/api-reference/property/Sound/RollOffMode

Ad

Answer this question