Need help with copying a texture to multiple sides of a part

I want to copy a specific decal onto every side of a part, I tried using Background:Clone() however it is code inefficient, the code is as follows right now:

local Background = Instance.new("Texture")

Background.Texture = "rbxassetid://" .. "6062528782"


Background.Face = Enum.NormalId.Front

local BackgroundBack = Background:Clone()


BackgroundBack.Face = Enum.NormalId.Back

for i in pairs do	
 i.Parent = script.Parent

end

Sorry for the inconvenience that I may cause if it’s really easy.

Loop through the enums using Enum:GetItems()

--applies texture to all surfaces of a part and returns a table of em
local faces = Enum.NormalId:GetEnumItems()
local function textureAllSurfaces(part,texture : Texture, editTextureFunction)
	local textureFaceTable = {}
	for _,enum in pairs(faces) do
		local textureClone = texture:Clone()
		textureClone.Face = enum
		editTextureFunction(textureClone)
		textureClone.Parent = part
		textureFaceTable[enum] = textureClone
	end
	return textureFaceTable
end

Thank you, I will attempt that solution.

It did not fix the problem for me, unfortunately: Can you please elaborate a little bit more on how to fix that?

You probably should describe your problem further so that I can fix it.

But I’m assuming you are having troubles with the editTexturefunction.

You can just remove it

--applies texture to all surfaces of a part and returns a table of em
local faces = Enum.NormalId:GetEnumItems()
local function textureAllSurfaces(part,texture : Texture)
	local textureFaceTable = {}
	for _,enum in pairs(faces) do
		local textureClone = texture:Clone()
		textureClone.Face = enum
		textureClone.Parent = part
		textureFaceTable[enum] = textureClone
	end
	return textureFaceTable
end

To use it in your code it would be like this

local Background = Instance.new("Texture")
Background.Texture = "rbxassetid://" .. "6062528782"

local part = script.Parent
textureAllSurfaces(part, Background)

Assuming part is script.Parent

1 Like

Thank you, that had fixed the issue I was having.