I do not want Enum.Material. in my text

Greetings! I am trying to create a material picker like this:


I do not want the text Enum.Material. in my text.

How can I fix this?

I had to put tostring() to get the material to properly register as a string.

My code is pretty simple:

local MaterialTemplate = script.Parent.Template

for _, Material in pairs(Enum.Material:GetEnumItems()) do
	local MaterialFrame = MaterialTemplate:Clone()
	MaterialFrame.TextLabel.Text = tostring(Material)
	MaterialFrame.Name = tostring(Material)
	MaterialFrame.Visible = true
	MaterialFrame.Parent = script.Parent.ScrollingFrame
end

If you can help, that would be great!

Thanks in advance!

1 Like


After digging through this page on the DevHub, each Enum has a Name property.

MaterialFrame.TextLabel.Text = Material.Name
2 Likes