How to make sounds fade as you get further away

I want to make my sounds fade as the player gets further away. I have tried rollOffMode on all options and it’s not working.

edit: I made a stupid mistake, instead of setting the RollOffMaxDistance distance to 1000 I set the RollOffMinDistance

2 Likes

The sound need to be inside a Instance that have a real world position. (Baseparts, Attachments, etc…)

Change the distance by changing the RollOffMaxDistance variable.

2 Likes

It is and the rolloffmax distance is 1000 but it just like turns on and off when I’m in range

2 Likes

You would need to write a script for this

local dist = (Part1.Position - part2.Position).Magnitude

sound.Volume = sound.Volume/dist * 2 -- or some number to make it louder, because it will be quiet at distances of even 2-3 if not multiplied.

-- this is just a rough draft. but you get the idea

Hope this helps a bit…

edit: part 1 is the start position of the sound, part 2 is the end position.

part1 would be a players humanoidrootPart btw.

1 Like
External Media

You dont need a script, can you send a screenshot of the sound in the explorer and the properties?

1 Like

Is there a property of the “Sound” instance i dont know about?

i always thought you needed a script to make the sound Fade out :confused:

Just use the sound’s RollOffMaxDistance property. It sets the max distance the sound can be heard. A fade-in and fade-out effect happens automatically, smoothly adjusting the volume based on your position. If you want to see it in action, just check the video I sent above.

1 Like

But OP said up here -

this also happens to me.
I don’t know though, could just be a bug.

Also, I didn’t Wanna download the file that was sent, so I couldn’t check it.

thank you for explaining to me! :laughing:

You forgot to set the RollOffMin distance. Do note that it is not recommended to set it greater than or equal to the Max distance setting.

I’d recommend doing 100 and slowly going higher as needed!

Well, just set the rolloffmode to, if I’m correct, taperedInverse. Then set the max distance to whatever you’d like, but make the min distance below it of course. The reason the sound just “turns on and off” is because…

diagram from images, you can see that inverse really is not smooth. I use inverse tapered but you can use any of them, it’s up to you.

You got those two mixed up, RollOffMinDistance should actually be lower than RollOffMaxDistance.

Also, the RollOffMode doesn’t have anything to do with the distance, just the style of the Roll off, but rather the Min and Max values are the actual distance controllers.

To prevent further confusion on the topic, here is a documentation regarding sounds:
Sound | Documentation - Roblox Creator Hub

1 Like

yeah I know that, and when it’s on Inverse it will proceed to cut off the sound early from when it should actually cut off, causing it to abruptly stop.


Sorry about that, I will edit the post

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.