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

Fade out volume script help?

So I am trying to fade in/Out the volume on this script and it dosen't seem to be working and I have no idea why.

local x = game.Workspace.DJBoardPRO
local o = script.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
	local Songs = {--Lots of audio ID's here I just didn't want them to be in--}
	if script.Parent.Text == "Auto Players current status: Off" then
		script.Parent.Text = "Auto Players current status: On"
		while script.Parent.Text == "Auto Players current status: On" do
			o.Header.Text = "AutoPlayer is on"
			x.Sound:Stop()
			x.Sound.Volume = 0
			x.Sound.SoundId = ""
			wait()
			x.Sound.SoundId = "http://www.roblox.com/asset/?id=" .. Songs[math.random(1, #Songs)]
			x.Sound:Play()
			
				function In() --Where I need help
					for i = 0, 1, 0.01 do
					wait(1)
					x.Sound.Volume = i
	
			wait(100)
			
				function Out()
					for i = 1, 0, -0.01 do
					wait(1)
					x.Sound.Volume = i
					
			x.Sound:Stop()
			x.Sound.SoundId = ""
						end
					end
				end
			end
		end
	else
		if script.Parent.Text == "Auto Players current status: On" then
			script.Parent.Text = "Auto Players current status: Off"
			o.Header.Text = "DJ-Board (Revised) V.15.2"
			x.Sound:Stop()
			x.Sound.SoundId = ""
			script.Disabled = true
			wait()
			script.Disabled = false
		end
	end
end)

1 answer

Pop a wait() in the loop for however long you want. Right now you're running through the entire loop in an instant.

1 comment

0

I added a wait of one second and it's not doing anything (:P) I will post the entire script, Maybe it's something else.

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