Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Get ID from rbxassetid:// ?

Asked by
Aimarekin 345 Moderation Voter
6 years ago

Hi. I am trying to get an integer from an rbxassetid://, but I need to figure out how do it. I tried this, but it doesn't work. I have no idea, would anybody help me out?

tonumber(string.sub(game.Workspace.Music.SoundId,string.len(game.Workspace.Music.SoundId)-(13)))

The script is supposed to get the last characters of a string (Counting the characters in the string and minus it by 13, the letters in rbxassetid.) and then using tonumber to make it an integer. But tonumber returns nil, which means the string contains also other characters rather than numbers... Any help?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
local ID = game.Workspace.Music.SoundId
ID = ID:sub(string.find(ID,"%d+"))
print(ID)
0
Not working. The string still has the : and the // Aimarekin 345 — 6y
0
I changed it, it works now. GetGlobals 343 — 6y
0
Thanks! Now working. Even if I didn't understand what that sub does :P Aimarekin 345 — 6y
Ad

Answer this question