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

How do i fade audio out smoothly?

Asked by
Ae_ka 0
8 years ago

I really want to fade my audio smoothly but i dont know how. Any help?

2
Use a for loop Im_Kritz 334 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago
Edited 8 years ago

As XXahraternotXX said in the comments, use a for loop to loop the audio volume down.

Here's an example,

local sound = script.Parent
sound.Volume = 1
sound:Play()

for i = 1,0,-0.03 do
    wait()
    sound.Volume = i
end

sound:Stop()

To make it fade faster or slower, change the number at the end of the i = thing. I used 0.03.

4
The 0.03 should be negative. You're counting up, not down. User#11440 120 — 8y
0
Oops, forgot. OldPalHappy 1477 — 8y
Ad

Answer this question