A simple way to do this, is simply set it to the string. You almost had it down, but in this case Enum.Material.(string)
, would not work. So, there is two different methods you can use. An example of what I mean is like this:
2 | game.Workspace.Part.Material = material |
7 | game.Workspace.Part.Material = Enum.Material [ material ] |
So to apply this to your script, we'll use the same variable and everything, and simply change it so that it sets the Material equal to the string:
1 | local material = script.Parent.Parent.MaterialPicker.MainFrame.CurrentMaterial.Value |
2 | slab.Material = material |
Now we'll try it using the second method:
1 | local material = script.Parent.Parent.MaterialPicker.MainFrame.CurrentMaterial.Value |
2 | slab.Material = Enum.Material [ material ] |
Either of these would work correctly, you can decide which one to use. For simplicity, I would go with the first method however.
Anyways, hope this helped. If you have any further problems/questions, please leave a comment below, and I'll see what I can do :P
-Dyler3