How to find an asset ID in studio

How would you get rid of this error? I wasn’t the one that inserted the sound so I have no idea where the sound that has the asset ID is, so I can’t delete it? I want to keep the output clean so it doesn’t get overflown with these errors.

3 Likes

In the command bar type this:

for i, v in pairs(game:GetDescendants()) do
if v:IsA("Sound") and v.SoundId == "rbxassetid://ID" then
v:Destroy()
end
end

Poor formatting due to being on phone

3 Likes


it just seems to be printing the code itself?

2 Likes

Yes. When you run a command, it prints the code, and then runs it. I guess the code never found a sound by the ID you specified.

1 Like

that is weird. I tried running the game and it printed the sound, but I couldn’t find it when I went out of playtest, and then my command bar was empty. I deleted a bunch of models and the sound must have been in one of those. I don’t know what I did wrong with the command bar though.

2 Likes

Where was the sound located when you run the game?

2 Likes

in a model in workspace. I don’t know which model though, because they are just called “model”.

1 Like

You can modify the code to select the sound when it finds one!

Replace:

print(v)

With:

game.Selection:Set({v})
2 Likes

so the command bar only works when running the game?

1 Like

The command bar works on the client, server, and edit mode.

1 Like

then why does it only work in-game for this code?
for i, v in pairs(game:GetDescendants()) do
if v:IsA(“Sound”) and v.SoundId == “rbxassetid://ID” then
print(v)
end end

1 Like

the issue is that it also unselects it when it goes out of the gametest

2 Likes

The sound is only there during the playtest.

The point of that was to let you find out where it is. So, where is it?

2 Likes

how could it only be there when playtesting though? It’s odd, but since I deleted the model, I don’t think I can find the reason why it would behave that way.

anyway this code does do what it is supposed to, so the command bar seems to be fine.

I’ll put a solved on the original answer, and we assume people looking for this won’t have the same issue as me (or they will just have to find a unique workaround like I did).

2 Likes

I don’t know why that sound only shows during playtesting. Perhaps a script is creating it? You should use Ctrl + Shift + F to find that soundid in all scripts. If nothing appears, then I don’t know. I tried finding out what that sound is called, but it doesn’t exist.

2 Likes

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