Hello,
I’m creating a script to serialize/de-serialize models, and lastly wanted to include materials. When trying to do this, my models Material.Value
came out really high (> 1000), and when I tried to convert this back to an Enum
using GetEnumItems()
, I get this issue:
Table is GetEnumItems()
and the number is the Material.Value
This results in the material being nil
function getEnum(value, enum)
print(enum:GetEnumItems(), value)
-- Adding 1 because .Value ranges from 0-x whereas the table goes from 1-x
return enum:GetEnumItems()[value + 1]
end
The enum list ends at rubber being 45, but for some reason, “Grass” on the tree is 1296?
The above function works perfectly for the parts shape, but on not material. If anyone knows how to fix this, that would be really appreciated!