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

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

Asked by 3 years ago
Edited 3 years ago

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)
0
What type of script is this? Where is it located? Also, you're not calling the function. xInfinityBear 1777 — 3y
0
ok, yk the function isn't called so obviously nothing happens. AProgrammR 398 — 3y
0
And also it's inefficient to use v.Playing = true, it's much better to do v:Play() PaleNoobs 37 — 3y
0
I did call it, this is only a portion of the script. But I suppose I should send the whole thing. NeoDogez 18 — 3y
View all comments (3 more)
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 NeoDogez 18 — 3y
0
Printing a table does not work either. GetChildren() returns a table, and you tried printing that table. Try doing print(Songs[1]) PaleNoobs 37 — 3y
0
Oh thanks! Post It as an answer so I can mark it. NeoDogez 18 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

0
I did, I just updated the desc. but that's not the problem. The problem is that it didnt get the children. NeoDogez 18 — 3y
Ad

Answer this question