Can't load Roblox published sounds

Roblox has a extensive sound library and I’m trying to get some SFX from it. The function keeps returning nil, and I have no idea why. Here is how I load assets:

local INSERT = game:GetService("InsertService")

local function loadAsset(assetId)
	if assetId == nil then return nil end
	for i = 1, 3 do
		local success, asset = pcall(INSERT.LoadAsset, INSERT, assetId)
		if success and asset then
			print(asset)
			print(asset:GetChildren())
			asset = asset:GetChildren()[1] -- it's automatically is wrapped in a model
			return asset
		end
	end

	print("Asset failed to load after retries!")
end

local asset = loadAsset(9117969892)
print(asset)

The asset in question: https://create.roblox.com/marketplace/asset/9117969892/Punch-Kit-Beefy-Hit-5-SFX

I know that the function works because I can load personal models with it AND it wouldn’t return nil if there was an error to retrieve the asset. InsertService is just returning a empty model.

I’m not sure if this is due to an issue with Roblox’s weird sound privacy changes. This doesn’t work in my group game (the place where I actually want to use it) or my personal testing place.

1 Like

Alright, so it seems I suffered a severe case of brain trauma because I was certain that this was the way you loaded animations and sounds. Apparently not.

To load a sound or animation, you don’t even need InsertService. Just create a new animation/sound instance and set its id to “rbxassetid://”…ID_HERE and it will do the rest.

Duly noted. A hour spent for a result is still better than a hour spent for nothing at all…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.