Proximity Audio Brick

Hi,

I was wondering if anyone could help me in making a script I can put in a part, that plays an audio. The close you get to the brick, the louder the audio gets, and vice versa. I am a builder, and have very little experience in scripting. I’m assuming this would be an easy script, but I may be wrong. (I don’t even know if it is possible to achieve this without a script or not, but tampering around in the properties of the audio, I saw nothing in which could help me.) I couldn’t find any FMs either in which could help me achieve this. Any assistance is greatly appreciated.

Thanks,

xPro_Do

1 Like

Putting audio into a part will automatically make it quieter/louder based on the player’s proximity to it. Explore sounds a bit more.

1 Like

Well that is what I thought, but when I tested it, it was either full audio or no audio.

1 Like

Is the sound’s parent the part?

Yes.

Your RollOffMode should be Linear, Inverse starts at max volume and becomes quieter as you approach the source.

2 Likes

Do you know how to make it be the closer your character gets rather than the camera?

1 Like

Since Roblox uses the camera it would be a bit tricky to do that efficiently. I would think one way would be to move the sound’s source part relative to the part’s position from your character’s position. There may be a better way though, I haven’t ever given that concept too much thought. I have a feeling it would be quite disorienting if the sound played around your character rather than your camera though.

1 Like

Increase the EmitterSize to a much higher number. That’s why you don’t hear it when you’re far away.