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

I used GetChildren() on a folder and it didn't get the children. Help?

I'm trying to make background music play, and it's not getting the children of the folder, "Music" which contains the songs. I used the function I made, nothing happened. I tried to print the songs. Nothing happened. Help please!

local Songs = script.Parent.Music:GetChildren()
print(Songs)
local function PlaySongs()
	for i, v in pairs(Songs) do
		v:Play()
		while v.Playing == true do
			wait()
		end
	end
end

PlaySongs()

script.Parent.Music.MiiMusic.Played:Connect(function()
	PlaySongs()
end)

7 comments

0

What type of script is this? Where is it located? Also, you're not calling the function.

0

ok, yk the function isn't called so obviously nothing happens.

0

And also it's inefficient to use v.Playing = true, it's much better to do v:Play()

0

I did call it, this is only a portion of the script. But I suppose I should send the whole thing.

0

It's a normal script inside the server storage. That my be the problem, but I'll wait for an answer to give a person reputation

0

Printing a table does not work either. GetChildren() returns a table, and you tried printing that table. Try doing print(Songs[1])

0

Oh thanks! Post It as an answer so I can mark it.

1 answer

You forgot to even call the function, I didn't see that but PlaySongs() should call it

1 comment

0

I did, I just updated the desc. but that's not the problem. The problem is that it didnt get the children.

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