How can I translate a URL to an AssetId?

My function returns:

http://www.roblox.com/asset/?id=6160938171

Now the number is right, but I want it like this:

rbxassetid://6160938171

Can anyone point me in the right direction to find out how to use this?
Also if you must know I’m using:

groupService:GetGroupInfoAsync(id)
local IconID = Details.EmblemUrl

1 Like

The url that your function returns should work fine. But, for the purpose that you are looking for, this is what I recommend.

You need to first get the ID from the url. To do this, use string.find to find the position of the equal sign, then string.sub to remove everything but the ID.

local url = "http://www.roblox.com/asset/?id=6160938171"
local ID = string.sub(url, string.find(url,"=")+1, string.len(url))

Then, you need to make the new URL

local newURL = "rbxassetid://"..ID
6 Likes

i dont have experience with URL Stuff but try this

Mesh.AssetId == http://www.roblox.com/asset/?id=6160938171
--Maybe roblox automatically fix it they do it in the studio

it may not work

1 Like

That works with meshes but I should’ve specified about ImageLabels, Thanks for your response.

It works! Thank you for the explanation aswell.

1 Like

How do you do it now with the new roblox creator marketplace thing?