Region Music Fade Out

I’m trying to make a region script for my roblox elevator game, but when I’m out of the elevator the music stops instantly.

What I want to do is make it so it fades out.

Please help me in this issue. I don’t know how to figure it out.

1 Like

from what i understood you already have a code to stop the music so all you need to do is change Sound:Stop() or Sound:Pause() to this loop
Side Note : Replace sound with your variable for the music

repeat
Sound.Volume -= .1 --// it will repeat sound.Volume -= 1 until the volume is 0
until Sound.Volume == 0

Due to precision error, it’s better to check if the value is less than or equal to 0. You also forgot to add a wait.

repeat Sound.Volume -= .1
wait(.1)
until Sound.Volume <= 0

oh your right, my bad after the loop I think there should be something like Sound.Volume = 0 to make sure it’s not negative in-case he will make it go up again

Change your Sound to Linear.
image
Worked for me

1 Like