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

Music volume down ?

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

I have a song and I want to transition the song with another song. But in order to do this, I need to lower down the volume while it plays until you can't hear it anymore. Any ideas on how to do that in a script?

2 answers

Log in to vote
0
Answered by
acecateer 130
10 years ago

Sounds have a property called 'Volume' 1 is basically the max volume and 0 is mute so lowering it in increments of 0.1 would be most effective. Use a loop to lower the volume gradually.

Example:

for i = 1, 10 do
    sound.Volume = sound.Volume - 0.1
end

To learn more about loops go here.

0
Who disliked this? He was simply asking how to lower the volume of a sound so I helped a bro out and told him about the Volume property and loops. Chill out acecateer 130 — 10y
0
Disliked since you put a for loop labeling it as "i" yet never used i in the script. Plus I'm not quite sure what "sound" is referring too:) Vividex 162 — 10y
0
@acecateer Including that 1 going to 10 wouldn't be decreasing, it would be increasing. It should be for i = 1, 0, -.1 Vividex 162 — 10y
0
This is just an example dude, chill yourself out. Go outside or something for a little bit and cool down. 'sound' was just referring to whatever sound he was going to have it's volume lower. acecateer 130 — 10y
Ad
Log in to vote
1
Answered by
Vividex 162
10 years ago

Heh, this should work, I am using a for loop which will repeat the code a certain amount of times:

for msound = 1, 0, -0.1 do --1 to 0, decreasing by 0.1
    game.Workspace.Sound.Volume = msound --What its used on
end --Ends the keyword for
0
You don't have to post something better, but at the same time, nice answer. acecateer 130 — 10y

Answer this question