How to get Sound.SoundId in numbers only?

Okay so, I have tried to find a solution to this, but failed.

I tried to do Sound.SoundId, but it gives me “rbxassetid://2862170886”, like it should. But I need just the “2862170886”, I tried some ways but they didn’t work, I would basically need a script that takes away the rbxassetid:// or only keeps the numbers.

1 Like

Format the asset to only retrieve the numbers.

local asset = "rbxassetid://2862170886"
local numbers = asset:match("%d+")
1 Like

Thanks, I am not really good at formatting.

1 Like

Here’s an article from our very own Developer Hub that may guide you:
https://developer.roblox.com/articles/string-patterns-reference

To be frank, I don’t understand them much either, but I look back here every now and again. Sometimes I remember how to use string patterns correctly, other times not so much.

There’s of course other articles out there, such as on the Lua website itself, but going to the Developer Hub for reference is a good start.

3 Likes