I used the following code:
1 | TextLabel.Text = tostring (part.Material) |
However, this sets the text to: 'Enum.Wood.Material', instead of 'Wood'. Is there a way to get the material name without having to use a 'if part.Material == Enum.Material.Wood then ..'?
Use substrings.
1 | print (string.sub( |
2 | tostring (Enum.Material.Glass), 15 , 20 ) |
3 | ) |
4 | -- "Glass" |
'Enum.Material.' takes up 15 characters, so it just comes down to finding everything after those.