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 = [[
https://www.roblox.com/library/1772424855/Check-Locked
https://www.roblox.com/catalog/1668107243/Faded-Nike
https://www.roblox.com/catalog/1721442724/VS-PINK-Maroon-Off-Shoulder-Top-Sale
https://www.roblox.com/catalog/1768703248/GUCCI-SNAKE
]]
-- just one of my decals and top shirts from the catalog

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

--[[
"/(%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) {
			console.log(list);
			return;
		}
		last = assets[0];
		for (object of assets) {
			list += object.href + "\n";
		}

		document.getElementsByClassName('pager-next')[0].children[0].click();
		setTimeout(logAndAdvance, 1000);
	}

	logAndAdvance();
})();

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
https://www.roblox.com/catalog/1028840446/Wild-West-Ranger-Hat
https://www.roblox.com/catalog/1028841160/Texas-Rodeo-Hat
https://www.roblox.com/catalog/116777823/Roblox-Visor
https://www.roblox.com/catalog/327364212/Opened-Iconic-Gift-of-Creation
https://www.roblox.com/catalog/327364011/Opened-Very-Important-Gift-of-Servers
https://www.roblox.com/catalog/326611535/Opened-Legit-Gift-of-Validated-Electronic-Mail
https://www.roblox.com/catalog/61847146/Halloween-2011-Paintball-Cap
https://www.roblox.com/catalog/102611803/Verified-Bonafide-Plaidafied
https://www.roblox.com/catalog/191273676/2015-ROBLOX-Visor
https://www.roblox.com/catalog/193696364/Purple-Ice-Crown
https://www.roblox.com/catalog/236398601/Bright-Star-Top-Hat
https://www.roblox.com/catalog/151784320/Doge
https://www.roblox.com/catalog/193659065/Golden-Antlers
https://www.roblox.com/catalog/192740596/Champion-of-Crimsonwrath
https://www.roblox.com/catalog/192465416/Winged-Headphones-of-Beautiful-Music
https://www.roblox.com/catalog/192477748/White-Banded-Red-Top-Hat
https://www.roblox.com/catalog/190077692/Purple-Frozen-Gift-of-the-Master-Developer
https://www.roblox.com/catalog/190077189/Opened-Golden-Gift-of-the-Epic-Modeler
https://www.roblox.com/catalog/190077131/Opened-Beautiful-Gift-of-the-Plentiful-Products
https://www.roblox.com/catalog/190006087/Opened-Sharp-Gift-of-Been-There-Played-That
https://www.roblox.com/catalog/190005795/Opened-The-Return-of-the-Badger-Badger-Badger-Gi
https://www.roblox.com/catalog/190076449/Opened-Impressionable-Gift-of-Publicity-Explosions
https://www.roblox.com/catalog/190245427/Next-Level-Blue-Headphones
https://www.roblox.com/catalog/190076296/Opened-Gift-of-Friends-and-Followers
https://www.roblox.com/catalog/190006041/Opened-Restricted-Gift-of-Short-Supply
https://www.roblox.com/catalog/190076262/Opened-Delightful-Gift-of-the-Developer
https://www.roblox.com/catalog/190113316/Winter-Styles-Scarf-and-Hat
https://www.roblox.com/catalog/189911645/Opened-The-Next-Level-Gift
https://www.roblox.com/catalog/189785233/Opened-Gift-of-the-Maker
https://www.roblox.com/catalog/189749728/Opened-Cool-Gift-of-Nice-and-Busy-Users
https://www.roblox.com/catalog/100460556/Santa-Bot-V12-25-Head
https://www.roblox.com/catalog/188004088/Star-Crossed-Warrior-of-the-Frozen-Tundra
https://www.roblox.com/catalog/93078560/Knight-of-the-Blood-Moon
https://www.roblox.com/catalog/102621051/Snake-Slate-Hood
https://www.roblox.com/catalog/51243431/Eyes-of-War
https://www.roblox.com/catalog/44113968/Kuddle-E-Koala
https://www.roblox.com/catalog/144303556/BreezeKreig-Ski-Cap
https://www.roblox.com/catalog/139618072/2014-Visor
https://www.roblox.com/catalog/139618317/Sk12r-Boi
https://www.roblox.com/catalog/128218044/The-Wisest-Wizard
https://www.roblox.com/catalog/137384831/Opened-Gift-of-Passage
https://www.roblox.com/catalog/136804833/Opened-Well-Outfitted-Gift-of-Style
https://www.roblox.com/catalog/121260272/Industrial-Revolutionary
https://www.roblox.com/catalog/113329638/Steampunk-Sweetheart-Top-Hat
https://www.roblox.com/catalog/105332455/Confused-Hatched-Wizards-of-the-Astral-Isle-Egg
https://www.roblox.com/catalog/102611450/Cannonical-Egg
https://www.roblox.com/catalog/102631707/Eggrachnophobia
https://www.roblox.com/catalog/101006911/Roblox-Visor-2013
https://www.roblox.com/catalog/1563352/Green-Banded-Top-Hat
https://www.roblox.com/catalog/30381365/Builders-Top-Hat
https://www.roblox.com/catalog/17640931/Unimaginative-Green-Hat
https://www.roblox.com/catalog/1374269/Kitty-Ears
https://www.roblox.com/catalog/110718551/Eggcellent-Builder
https://www.roblox.com/catalog/110720049/Eggsultant-Contributer
https://www.roblox.com/catalog/110790103/Eggsplosion
https://www.roblox.com/catalog/110789152/Eggvertisement-Egg
https://www.roblox.com/catalog/110790905/Speech-Bubble-Hatched-TL-DR-Egg
https://www.roblox.com/catalog/110789084/The-Easiest-Egg
https://www.roblox.com/catalog/110790044/Eggscrutiatingly-Deviled-Scripter
https://www.roblox.com/catalog/25882612/Erik-Cassels-Hat
https://www.roblox.com/catalog/99178000/Opened-ROBLOX-Newshound-Gift
https://www.roblox.com/catalog/1567446/Verified-Sign
https://www.roblox.com/catalog/1081366/Astronaut-Helmet
https://www.roblox.com/catalog/91664765/Classic-Bowler
https://www.roblox.com/catalog/9466840/Extreme-Sports-Helmet-BASE-Jump-Black
https://www.roblox.com/catalog/1080951/Builders-Club-Hard-Hat
https://www.roblox.com/catalog/78621687/Timelord
https://www.roblox.com/catalog/76692831/Vampiric-Egg-of-Twilight
https://www.roblox.com/catalog/76692532/Office-Professional-Egg
https://www.roblox.com/catalog/76695554/Egglords-Circlet
https://www.roblox.com/catalog/76695524/Egglords-Rexus
https://www.roblox.com/catalog/76692437/Combo-Egg-of-Trolllolol
https://www.roblox.com/catalog/76692269/Egg-Timer
https://www.roblox.com/catalog/76692331/Ethereal-Ghost-Egg
https://www.roblox.com/catalog/76692381/Hyperactive-Egg-of-Hyperactivity
https://www.roblox.com/catalog/76692077/Futuristic-Egg-of-Antigravity
https://www.roblox.com/catalog/68268372/ROBLOX-Visor-2012
https://www.roblox.com/catalog/68319489/Opened-Snowpacalypse-Gift-of-December-26th
https://www.roblox.com/catalog/67996003/El-Presidente
https://www.roblox.com/catalog/67996343/Big-Ad-Man-Fedora
https://www.roblox.com/catalog/67996065/Golden-Pixel-Award
https://www.roblox.com/catalog/67316178/Opened-Remarkable-Gift-of-Experience
https://www.roblox.com/catalog/67385332/Opened-Orchid-Gift-of-Alliances
https://www.roblox.com/catalog/68033478/Opened-Irresistible-Gift-of-High-CTR
https://www.roblox.com/catalog/68033700/Opened-Supermodeler-Gift
https://www.roblox.com/catalog/66897142/Opened-Directors-Gift-of-MeTube
https://www.roblox.com/catalog/66897099/Opened-Generous-Gift-of-the-Rising-Sun
https://www.roblox.com/catalog/61847146/Halloween-2011-Paintball-Cap
https://www.roblox.com/catalog/63641134/Newt-Head
https://www.roblox.com/catalog/64438501/Zachary-Elloit-Dencourt-III
https://www.roblox.com/catalog/64438501/Zachary-Elloit-Dencourt-III
https://www.roblox.com/catalog/64400604/Leader-of-the-Pack
https://www.roblox.com/catalog/63952321/Cursed-Mummy-of-Ramses-II
https://www.roblox.com/catalog/63237842/Halloween-Stage-Prop
https://www.roblox.com/catalog/63240558/Vlad-the-Impaler-VI
https://www.roblox.com/catalog/63235210/Opened-Gift-of-Blinkypinkyinkyclyde
https://www.roblox.com/catalog/63234463/Opened-Gift-of-the-Three-Witches
https://www.roblox.com/catalog/62731652/Opened-Stylized-Gift-of-the-Chiroptera
https://www.roblox.com/catalog/63083988/Opened-Obvious-Gift-is-Obvious
https://www.roblox.com/catalog/63088628/Opened-Cursed-Gift-of-Ramses-II
https://www.roblox.com/catalog/63084430/Opened-Cursed-Gift-of-the-Full-Moon
https://www.roblox.com/catalog/63233124/Opened-Preeesssennnt
https://www.roblox.com/catalog/1158038/Classic-ROBLOX-Pumpkin-Head
https://www.roblox.com/catalog/62738208/Opened-Gift-of-the-Sixth-Undead
https://www.roblox.com/catalog/62732345/Opened-The-Pendant-Gift
https://www.roblox.com/catalog/55646969/Kommander-Kitteh
https://www.roblox.com/catalog/55617090/Space-Lulz
https://www.roblox.com/catalog/1082932/Traffic-Cone
https://www.roblox.com/catalog/17407999/Eyes-of-the-Everworld
https://www.roblox.com/catalog/17408011/Outrageous-Aetherspectacles
https://www.roblox.com/catalog/17408016/Hood-of-the-International-Order-of-Buildmasters
https://www.roblox.com/catalog/17408283/Outrageous-Builders-Club-Hard-Hat
https://www.roblox.com/catalog/35631125/Autumn-Leaves
https://www.roblox.com/catalog/42900214/ROBLOX-Visor-2011
https://www.roblox.com/catalog/40892630/Minty-Fresh-Fedora
https://www.roblox.com/catalog/20264649/2010-ROBLOX-Visor
https://www.roblox.com/catalog/1098285/Stage-Prop
https://www.roblox.com/catalog/29283289/Citizen-01
2 Likes

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.