New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Help me out with this?

Asked by
RxDev 0
4 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
4 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
4 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