Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help me out with this?


So how could I make this fade out? the music would get quit, like Wait(1) wait(2) then it fades out, help? thanks.


local s = Instance.new("Sound")

s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=154786522" s.Volume = 1 s.Pitch = 2.0 s.Looped = false s.archivable = false

s.Parent = game.Workspace

wait(1)

s:play()

2 answers

I added a new block of code that waits a second before reducing the volume by .1 in a For Loop.

local s = Instance.new("Sound")

s.Name = "Sound" 
s.SoundId = "http://www.roblox.com/asset/?id=154786522" 
s.Volume = 1 
s.Pitch = 2.0 
s.Looped = false 
s.archivable = false
s.Parent = game.Workspace
wait(1)
s:play()

for i = 10,1,-1 do
wait(1)
s.Volume = i / 10
end
local s = Instance.new("Sound")

s.Name = "Sound" 
s.SoundId = "http://www.roblox.com/asset/?id=154786522" 
s.Volume = 1 
s.Pitch = 2.0 
s.Looped = false 
s.Parent = game.Workspace

wait(1)

s:play()
wait(3) -- if thats what you mean
for i=1,10 do
s.Volume = 1-(i*.1)
wait(0.2)-- takes two seconds to fade out
end

This discussion is preserved as it was. New answers, comments, and votes are closed.