Is there a way to get all or any currently playing audios?
for i, instance in pairs(game:GetDescendants()) do
if instance:IsA("Sound") then
if instance.IsPlaying then
print("The sound is playing!")
end
end
end
I mean like just a general audio playing. If it wasnt in the workspace, just getting all audios or current audios.
That’s what game:GetDescendants()
would achieve, game is the global variable which represents the DataModel, the DataModel acts as a container for all instances (excluding instances parented to nil).
Add another part to the if statement where it checks if the parent is == instance here
Out of curiosity, what’s your use case here? Do you predictably know what audios are going to play and where? You could iterate through services to check for an audio’s IsPlaying property but that doesn’t sound particularly smart so I’m interested to know what system you’re trying to accomplish.
1 Like