How do i get Attribute name in a ToString()

Then could this work?:

for i,v in pairs(workspace:GetChildren()) do
v.Material = Enum.Material[v:GetAttribute("SecMaterial")] -- to find the material and set it
end
for i,v in pairs(workspace:GetChildren()) do
	local NewMaterial = v:GetAttribute("SecMaterial")
	if NewMaterial then
		v.Material = Enum.Material[NewMaterial] -- to find the material and set it
	end
end

You forgot to check if the Attribute exists but this should work

1 Like