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

Help me out with this?

Asked by
RxDev 0
8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
0
Answered by
Im_Kritz 334 Moderation Voter
8 years ago

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
Ad
Log in to vote
0
Answered by
Decemus 141
8 years ago
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

Answer this question