How do I convert and Asset Id to an Int64

What I am trying to do here is to convert an Id (“rbxassetid://1234567890”) to an Int64 (“1234567890”)
Is anyone able to help me, and if you can help me please reply with your solution?

local assetId = "rbxassetid://1234567890"
local start = 14 --the first number of the Id
local Id = tonumber(string.sub(assetId, start, #assetId)) --asset id is substring of assetId that starts at the first number to the end of the string, then use tonumber
1 Like

This solution work for me, I tried doing this and it did not work.

local function GetShirtId(AssetId)
	local assetId = AssetId
	local start = 14 --the first number of the Id
	local Id = tonumber(string.sub(assetId, start, #assetId)) --asset id is substring
	
	return Id
end

local Id = GetShirtId(script.Parent.Clothing.ShirtTemplate)
print(tostring(Id))

The value that was return was nil

why do you make another variable called “assetId” if you can just use “AssetId” instead.

Did you try to print out the shirttemplate before the first line of the function?