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

Won't edit all the sounds help?

I hear the sounds

except I can't change them :/

My loop won't edit the volume of all the children named " sound", how u do

local Audios = game.Workspace.DJBoardPRO:GetChildren()

script.Parent.MouseButton1Down:connect(function()
    for i,v in pairs(Audios) do
        if v.Name == "Sound" then -- creates a new thread, something like a ghost script
                v.Volume = v.Volume - .1
        end
    end
end)

1 comment

0

Change line 5 to: if v:IsA("Sound") then This basically checks if the child is a sound, names don't matter

1 answer

Your Problem

As you told me in the chat, the sounds are added dynamically. Due to this, you need to define 'Audios' inside the MouseButton1Down event! When you define the value then it becomes static, not dynamic. 'Audios' is not going to change from when you first defined it, and when you first defined it there was no children.

Code

script.Parent.MouseButton1Down:connect(function()
	local Audios = game.Workspace.DJBoardPRO:GetChildren()
	for i,v in pairs(Audios) do
		if v.Name == "Sound" then
			v.Volume = v.Volume - .1
		end
	end
end)

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