Quick and easy way to replace a soundID with new soundID in your game

Not really a Community Resource worthy piece of script here, but I think it could be helpful to many at this time:

I’m sure there is a plugin to easily replace sound instance id’s in the workspace, serverstorage, and replicatedstorage, or a better way to do it, but for anyone that just wants to run a quick script this will work:

local soundToReplace = 123456789
local newsoundID = 987654321 
newsoundID = "rbxassetid://"..newsoundID
soundToReplace = "rbxassetid://"..soundToReplace

print("replacing oldsound:", soundToReplace, "with newsound:", newsoundID)

function replaceSound(path)
	for _, child in ipairs(path:GetDescendants()) do
		if  child:IsA("Sound") and child.SoundId == soundToReplace then
			print("replaced sound", child.Name)
			child.SoundId = newsoundID
		end
	end
end

replaceSound(workspace)
replaceSound(game.ReplicatedStorage)
replaceSound(game.ServerStorage)

test run output:

13:59:11.925   ▼ replaced sound Explosion (x18)  -  Edit
     13:59:11.925     replaced sound Explosion
     13:59:11.925     replaced sound Explosion
     13:59:11.925     replaced sound Explosion
     13:59:11.925     replaced sound Explosion
     13:59:11.926     replaced sound Explosion
     13:59:11.926     replaced sound Explosion
     13:59:11.926     replaced sound Explosion
     13:59:11.931     replaced sound Explosion
     13:59:11.932     replaced sound Explosion
     13:59:11.932     replaced sound Explosion
     13:59:11.932     replaced sound Explosion
     13:59:11.932     replaced sound Explosion
     13:59:11.932     replaced sound Explosion
     13:59:11.933     replaced sound Explosion
     13:59:11.933     replaced sound Explosion
     13:59:11.933     replaced sound Explosion
     13:59:11.933     replaced sound Explosion

If you only have a handful to replace clicking and pasting is fine, but if you have a hundred… not so much.

I just used this by pasting into the console command bar.

4 Likes

i mean if it supported multiple audio replacement it would be good. thus some scripts only inserts audio through scripts, so you might need a plugin for that

For scripts you an already use the built-in find/replace tool.

C’mon I don’t wanna go to every single script and replace I’d. However this seems as a great plugin idea.

What do you mean, you put your old id in the search box, put your new id in the replace box then click replace all.

If you have 100 scripts with this ID they’ll all get replaced instantly, doens’t get much easier than that.

image

built into Studio

1 Like

You kind of win… but it dosent support multiple replacement at a single time

2 Likes

it would be very useful if it replaced the ones from SoudService too

I have never put a sound instance in SoundService, but if that is what you are doing adding this line should work:

replaceSound(game.SoundService)