How do I define all sounds in workspace regardless if they're in a model or not?

I’m trying to define all sounds inside of workspace; like this:

for i,v in pairs (game.Workspace:GetChildren()) do

The issue is, it’s only defining what’s under workspace, not inside? Because it’s only getting the children that are parented under workspace, so the question would be; how would I define all of the sounds that are inside workspace like inside models and such, inside of the GetChildren format?

Use get descendants, you can also edit your original post

1 Like

I was just about to say lol

@idolcorbin If it helps, GetDescendants() is basically your “Metal Detector” of searching for specific objects

for i, v in pairs(workspace:GetDescendants()) do -- I FORGOT THE DO STATEMENT
    if v:IsA("Sound") then
        print("Sound Object found, name:", v)
    end
end
1 Like

use :GetDescendants()

for i, v in pairs (workspace:GetDescendants()) do
    -- code here
end

Oh, good, I didn’t think of descendants; I kind of forgot about it because I used it in a previous project and it didn’t work out well for me; I’ll see if it does this time; thank you.