How to bulk import images and keep the name?

I have a lot of images, more than 200. These images form a high quality world map I plan to use, however, it seems like dragging the images from the file manager to the workspace does not keep the name and sets it to “Decal”. This is terrible because I can not order the world map easily with a function and I dont want to play a puzzle for 1 hour for a world map (Which there are 12, as one for every month).

Even if I pressed Right Click + Insert, the name is also removed. The name is truly required because that is what is going to save me 40 hours of work by just getting the column, row and putting the decal where it should be.

Does anyone have an idea on how to fix it? :face_with_diagonal_mouth:

In the file manager:

Inserting:

image

I’ve written a simple Script that uses MarketPlaceService to get the name of the decals specified (I’ve used decals that are children of Workspace in this Script) and replaces them with their names:

local MarketplaceService = game:GetService("MarketplaceService")


for _,v in pairs(workspace:GetChildren()) do
	if v:IsA("Decal") then
		

		local id = string.gsub(tostring(v.Texture), "rbxassetid://", "")


		local asset = MarketplaceService:GetProductInfo(id)
		local cutName = string.gsub(asset.Name, "Images/", "")
		v.Name = cutName
		task.wait(0.1) -- Delay
	end

end

It basically searches for their ID in the Texture of the Decal, uses MarketplaceService:GetProductInfo and cuts out the Images/ part of their name off the final name, before setting the name to the decal object.

Hope this helps!

2 Likes

Amazing solution! I would’ve never thought about it. I might even create a simple plugin from it so I can speed up things.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.