✓ Accepted answer
Well, this will iterate through Roblox Ids up to the "max" value
local market = game:GetService("MarketplaceService")
local array = {}
local debounce = true
local max = 3000000000
for i = 0, max do
if debounce == false then return end
debounce = false
local sound = workspace.Test
local success, result = pcall(function()
sound.SoundId = ("rbxassetid://"..i)
end)
if success and sound.TimeLength > 0 then
local new = #array + 1
table.insert(array, new, i)
print("success")
else
warn(result)
end
wait()
debounce = true
end
workspace.Test:Destroy()
while true do
local random = math.random(1, #array)
for i, v in pairs(array) do
if v == random then
workspace.Sound.SoundId = ("rbxassetid://"..v)
workspace.Sound.SoundId:Play()
local length = tonumber(workspace.Sound.TimeLength)
wait(length)
end
wait()
end
end
The above example utilizes two sounds ("Sound" and "Test") in the Workspace
There will be errors thrown, but the script will continue running. Due to the sheer amount of assets in ROBLOX this script would still take some time to go through all of the them
Another thing you could try is JSON Decoding on the ROBLOX catalog:
https://developer.roblox.com/api-reference/function/HttpService/JSONDecode
The other method you could try is checking the marketplace service asset ids, this will prevent any errors from being thrown but has a cooldown time after 100 checks are reached.
5 comments
As in from all sound ids in Roblox, or preset random music?
All sound ids in Roblox if that is possible.
like to get a random one then play it
I will edit with something i had in mind but i dont know if it is possible
The best way to accomplish this would be if you can grab the IDs from catalog through HTTPService, place them within a table and use math.random to pick a random index