Sounds not playing on the server

I made this script which downloads information on the 10 latest sounds that Monstercat uploaded to Roblox, and then creates a playlist using them.

It creates the sounds using the Id and the Name received from the HTTP request. They get parented like they should, and the loop goes through them normally as well. I can print the sounds’ progress and they progress normally, but it just isn’t playing the sounds.

Their SoundGroup property is also set to a SoundGroup named Sounds parented to SoundService. There isn’t any error in the output.

local HttpService = game:GetService("HttpService")
local SoundService = game:GetService("SoundService")

local sounds = workspace.Sounds
local requestUrl = "https://inventory.rprxy.xyz/v2/users/1750384777/inventory/3?limit=10&sortOrder=Asc"

local soundTemplate = Instance.new("Sound")
soundTemplate.SoundId = "rbxassetid://"
soundTemplate.SoundGroup = SoundService:WaitForChild("Sounds")
soundTemplate.EmitterSize = 1e3
soundTemplate.Volume = 1

local success, result = xpcall(function()
	return HttpService:JSONDecode(HttpService:GetAsync(requestUrl))
end, function(error_)
	warn(error_)
	coroutine.yield()
end)

local playlist = table.create(10) --// amount of sounds in the link

for _, item in ipairs(result.data) do
	local sound = soundTemplate:Clone()
	sound.SoundId ..= item.assetId
	sound.Name = item.assetName
	sound.Archivable = false
	sound.Parent = sounds
	
	table.insert(playlist, sound)
end

while true do
	local index, currentSound = next(playlist)
	currentSound:Play()
	
	currentSound.Ended:Wait()
	table.insert(playlist, table.remove(playlist, index))
end
--// thanks for stopping by
1 Like

Before i can help, Is this a local script or just a script?

1 Like

It’s a normal script in ServerScriptService

1 Like

Maybe try preloading the sounds using ContentProvider:PreloadAsync?

1 Like

i’ll try this, but I don’t think it’ll make a difference as the sounds are loading properly - i can print the names and the id and it works correctly, but they don’t play

Update: yep, this also didn’t fix it

1 Like

does the sound play on the client? i tried a script one time and it will never play on the server and idk why

i’ll try this as well after the ContentProvider suggestion, 1 min

1 Like

this also isn’t working. I tried sending the table playlist to the client using a remoteevent, and I also tried playing the sounds parented to workspace directly. They both say they’re playing, but they don’t actually play, just like the server.

This sounds silly, but try to increase your in game volume up when you play test. Sometimes I do not notice this and it ends up “appearing” to not play.

1 Like

print the sound id it might be nil so thats why probably that it isnt working

yea, I tried this as well. I think the problem might be with the http link, i’ll try printing out every single audio’s name

edit: @FerbZides yes i thought this right before you said it lol

your solution worked, i made such a silly mistake lol

it was being set to bxassetid://number instead of rbxassetid://number. I guess I must’ve fixed it when I posted it here but i forgot to fix it in the script itself.

It works, thanks for helping everyone
i wish this errored so I could’ve figured this out sooner, but it just silently failed :confused: