✓ Accepted answer
If you want to get an EnumItem of a string in the format you've provided, I can only think of looping through the members of said Enum using its GetEnumItems method, and checking for matches.
local that = ("Enum.PartType.Block")
for i, v in next, Enum.PartType:GetEnumItems() do
if tostring(v) == that then
warn(v)
else
print(v)
end
end
If you want to be able to use the actual enumerated value, you could make a function to return the EnumItem from a provided string. It would work a little like the following..
local that = ("Enum.PartType.Block")
local part
enumFromString = function( str )
for i, v in next, Enum.PartType:GetEnumItems() do
if tostring(v) == that then
return v
end
end
end
local this = enumFromString(that)
part.Shape = this
2 comments
Why not just do part.Shape = "Block"?
Because the string is the return of a format JSON save which is only composed of string values.