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

Invalid value "Bricks" for enum Material?

Hi, I wanted to make a script that changed the part's material but I can't seem to see how to do it...

local text = script.Parent --The text is "Brick"
part.Material = text.Text

and I get:

 Invalid value "Bricks" for enum Material

Why? Please help! Thanks!

1 comment

0

To change Material we use enum value, but in your script you use string value.

1 answer

✓ Accepted answer

This is because Bricks is not an existing material Enum. It’s best you take a look at the list of BasePart materials to see what you can actually apply to the part before making an assumption.

This material exists however, it’s simply just called Brick instead of Bricks

It is also a poor practice to assign Enums via String. Use the Enum keyword and assign the respectful material this way:

local Material = script.Parent.Text
Part.Material = Enum.Material[Material]

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