How do I get ids via code with Name?

I fond myself having to transfer over 300 shirts and over 500 decals into my game(not while running it I just need those for my game)

This will take over 14 straight hours by copying from my web then pasting in studio manually so there must be another way. I heard of the InsertService and am wondering if I could write a small code and search the title of my decals to do the work for me.

If there is a way tell me please.

If you can get all of the ids for the shirts and decals into a text file, then you can run a script to loop through all of them.

Given the id of a shirt or decal, you can insert the object at that id to get a Shirt or Decal object. I’m not sure if InsertService will do this, but I know that game:GetObjects will.

This would look something like:

local urls = [[
-- just one of my decals and top shirts from the catalog

for id in urls:gmatch("/(%d+)/") do
	local assetUrl = "rbxassetid://"
	print("Inserting "..assetUrl.." to ServerStorage")
		local success, err = pcall(function()
			local objects = game:GetObjects(assetUrl)
			for _, object in next, objects do
				object.Parent = game.ServerStorage
		if not success then
			warn("Failed to insert "..assetUrl.." because "..tostring(err))

"/(%d+)/" is a pattern

/ matches a "/"

%d matches any number
%d+ matches 1 or more numbers
(%d+) matches 1 or more numbers and returns it

/ matches a "/"

In summary, "/(%d+)/" matches a slash, numbers, then another slash, and it returns the numbers.

Gmatch will loop through all matches in a string.

You have to run this in the command bar, as a plugin, or using the “Run Script” tool in Studio in order to use GetObjects.

1 Like

That’s then promblem though. Would it not take forever to get the ids from every URL of my tons of shirts.

Assuming you copy the urls manually then it’s certainly easier to paste urls into a big list than it is to paste into properties of objects in Studio.

You don’t have to do it manually, though. You presumably already have a list somewhere. Maybe it’s in your bookmarks, or maybe it’s in your favorited items on the website, or maybe it’s in your inventory.

You can write a small bit of JavaScript and run it in your browser to output all of the urls for all of the pages, which you can then plug in to the above snippet to get into Studio.

Where or how do you have all of the links to these shirts and decals saved?

Actually I have a better idea. Sense I uploaded them all around the same time I could get the ids of the first Shirt and the if of the last Shirt and check all the shirts in between to see if they are mine then if so just import them into my game with the given name.

To give you an example, the following JavaScript will output a list of the urls of everything in the opened inventory page:

(function() {
	let list = "";
	let last = null;
	function logAndAdvance() {
		let assets = document.getElementById('assetsItems').getElementsByClassName('item-card-link');
		if (assets[0] == last) {
		last = assets[0];
		for (object of assets) {
			list += object.href + "\n";

		setTimeout(logAndAdvance, 1000);


You can run this in the Console tab of your browser’s Developer Tools. Normally, you can access the Developer Tools using F12.

If it finishes too early, it’s likely because you have slow internet and it took more than 1 second to load the next inventory page. You can change 1000 to a higher number to wait more time between pages. 1000 is 1 second, 2000 is 2 seconds, etc.

This produces the following output for all of my hats

Doing my way will make it soo I don’t need to assign them to there matching name. I could just use some code to do all the work. But I’ll do that if I my other idea fails.