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

How do I preload sounds that are in a folder? Can't figure this out for the life of me.

Asked by 6 years ago
Edited 6 years ago

For some reason my game audio sometimes doesn't play for some users, so I figured I may have to PreLoad it. What I mean by "doesn't play for some users" is sometimes when a user joins a server and a sound is supposed to play across the Server, it plays for most people but sometimes doesn't play for random people. The only way for them to fix this is, is to rejoin the game. It's never a specific audio, it's random each time.

The problem is, PreLoading it still doesn't seem to be fixing the issue. I can't figure out why, I've tried many ways but this is the latest one:

game:GetService('ContentProvider'):PreloadAsync({workspace.AudioToLoad})

"AudioToLoad" is the name of the folder that the audio is in.

Thanks.

0
Have you tried putting the folder in ReplicatedFirst? ThatPreston 354 — 6y

1 answer

Log in to vote
0
Answered by
ee0w 458 Moderation Voter
6 years ago

{workspace.AudioToLoad} creates an array with the folder. This is not what you want. Instead, use the GetChildren method, which returns a table with every child in it.

game:GetService('ContentProvider'):PreloadAsync(workspace.AudioToLoad:GetChildren())
Ad

Answer this question