Quickly Applying Decals to Image Objects

It’d make the process much faster if when you select one of the following items (or multiple):
[ul]
[li]ImageLabel[/li]
[li]ImageButton[/li]
[li]Decal[/li]
[li]StringValuei[/i][/li]
[/ul]

And then insert a decal from the toolbox, instead of creating a new decal instance, it would apply the image ID to the item. This would save me loads of time, as I have to insert a decal, steer it away from parts so it doesn’t apply it to them (and so the link in the properties window doesn’t go away, as it appears there until you hover over a part) and then delete it after wards. Selecting multiple image objects and then inserting a decal from the toolbox would apply the image ID to all of them.

Tried to do this with a plugin, wasn’t possible. Ends up with output being spammed in errors where studio keeps trying to parent the destroyed decal.

local properties = {
	"Image",
	"Texture",
	"TextureId",
	"ShirtTemplate",
	"PantsTemplate",
	"Graphic"
}

game.DescendantAdded:connect(function (child)
	local selection = game.Selection:Get()
	local isDecal pcall(function ()
		isDecal = child:IsA'Decal'
	end)
	if isDecal then
		local count = 0
		for _, object in pairs(selection) do
			for _, property in pairs(properties) do
				local hasProp pcall(function ()
					hasProp = type(object[property]) == "string"
				end)
				if hasProp then
					count = count + 1
					object[property] = child.Texture
					break
				end
			end
		end
		if count > 0 then
			wait()
			child:Destroy()
		end
	end
end)

[size=5][size=1]14:18:45.272 - The Parent property of Decal is locked, current parent: NULL, new parent Part[/size][/size]

It’s giving you that error because you’re deleting the decal pretty much at the same time it’s trying to be set. Throw in a spawn and that’ll fix the error.

if count > 0 then
    wait()
    spawn(function() child:Destroy() end)
end

Also, I recommend waiting a couple seconds until you run the plugin because it’ll pick up decals loading in with DescendantAdded if you hook up that check immediately.

[quote] It’s giving you that error because you’re deleting the decal pretty much at the same time it’s trying to be set. Throw in a spawn and that’ll fix the error.
[/quote]Please read my post fully before responding. I made note that it’s not my script throwing that error and instead it’s studio trying to set the parent of the decal I have just called :Destroy() on.

This would be awesome, but I’d also love the old method of pasting decals onto bricks back. And maybe a toggle/ setting you can choose to apply the image as a decal or a texture object.

Life would be a breeeeeze