Hey all, I was curious how it would be possible to play all audios from a list.
I was hoping that it would fetch the audios from my inventory (that works, I tried printing it into console), then play them all silently so that it gets added to someone’s cache so that you can hear the audio in a different game. Shrimple as that. Here is the code I have:
local List = script.Parent.Parent.Parent
local HttpService = game:GetService("HttpService")
local InvURL = "https://inventory.roproxy.com/v2/users/809620631/inventory/3?sortOrder=Asc&limit=100"
local response = (HttpService:JSONDecode(HttpService:GetAsync(InvURL)))
i = 4
v = 0
ids = response.data
print(response.data)
I didnt exactly understand what you were trying to say, but i did understand what the code was trying to do.
Server:
local HttpService = game:GetService("HttpService")
local InvURL = "https://inventory.roproxy.com/v2/users/809620631/inventory/3?sortOrder=Asc&limit=100"
local response = (HttpService:JSONDecode(HttpService:GetAsync(InvURL)))
local v = 0
ids = response.data
local LoadSounds = Instance.new('Folder')
LoadSounds.Parent = game:GetService('SoundService')
for i,sound in pairs(response.data) do
local Newsound = Instance.new("Sound")
Newsound.SoundId = "rbxassetid://"..sound.assetId
Newsound.Parent = LoadSounds
end
Client:
local ContentProvider = game:GetService('ContentProvider')
local LoadSounds = game:GetService('SoundService'):WaitForChild('LoadSounds')
local function LoadSound(Sound)
ContentProvider:PreloadAsync({Sound.SoundId})
end
LoadSounds.ChildAdded:Connect(function(Child)
if not Child:IsA('Sound') then return end
LoadSound(Child)
end)
for i,v in pairs(LoadSounds:GetChildren()) do
LoadSound(v)
end