Hello,
Ive created a script that randomly plays one of about 20 tracks I have preset that loop constantly through the game. I have noissues on computer and studio, but when I go to join on mobile it doesn’t load and doesn’t play anything. Ive even tried to preload all of the audio before playing it but im not sure why. I don’t know if it has anything to do with this code or really what at all causes it.
Heres the code:
for i,v in pairs(soundService:GetChildren()) do
game:GetService("ContentProvider"):PreloadAsync({v})
end
function music()
local num = math.random(1,#soundService:GetChildren())
for i,v in pairs(soundService:GetChildren()) do
if i == num and not v:FindFirstChild("Effect") then
v:Play()
game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui").Pause.Music.Text = v.Name
wait(v.TimeLength)
end
end
end
while wait() do
music()
end
Any help is appreciated!