Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I find all of the decals inside a part?

IDs = {}
IDs[1] = 161409451
IDs[2] = 161409465
IDs[3] = 161409476
IDs[4] = 161409489
IDs[5] = 161409502
IDs[6] = 161409525
IDs[7] = 161409534
IDs[8] = 161409551
IDs[9] = 161409824

Ore = script.Parent
Decals = {Ore.Top,Ore.Bottom,Ore.Front,Ore.Back,Ore.Right,Ore.Left}
-- "Sides" are names of the decals within the Ore
Link = "http://www.roblox.com/asset/?id="

-- I skipped a bit of unimportant code

	for i = 1, 9, 1 do
		print(2)
		local child = Decals
		if child.ClassName == "Decal" then
			print(3)
			child.Texture = Link..IDs[i]
			print(4)
		end
		wait(mineSpeed.Value)
		print(5)
	end

How do I get the children inside a part (only the decals) and change their textures all at once? The output tab doesn't show the printed 3 and 4 numbers, so I'm guessing I've messed up on the if function.

1 answer

✓ Accepted answer
IDs = {}
IDs[1] = 161409451
IDs[2] = 161409465
IDs[3] = 161409476
IDs[4] = 161409489
IDs[5] = 161409502
IDs[6] = 161409525
IDs[7] = 161409534
IDs[8] = 161409551
IDs[9] = 161409824

local Ore = script.Parent
local Link = "http://www.roblox.com/asset/?id="

ChangeID = function(ID)
	for _,Decal in pairs(Ore:GetChildren()) do
		if (Decal:IsA("Decal")) then
			Decal.Texture = Link..ID
		end
	end
end

for i=1,#IDs do
	ChangeID(IDs[i])
	wait(mineSpeed.Value)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.