Last active
February 7, 2024 16:53
-
-
Save gaymeowing/3157f8b02a7de11422368718f5f7fd4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function AssetTypeToAccesoryType(AssetType: Enum.AssetType): Enum.AccessoryType | |
local Success, EnumItem = pcall(function(EnumItemName) | |
return if Enum.AccessoryType[EnumItemName] ~= nil then Enum.AccessoryType[EnumItemName] else nil | |
end, string.split(AssetType.Name, "Acc")[1]) | |
return if Success then EnumItem else Enum.AccessoryType.Unknown | |
end | |
print(AssetTypeToAccesoryType(Enum.AssetType.WaistAccessory)) --> Enum.AccessoryType.Waist | |
print(AssetTypeToAccesoryType(Enum.AssetType.Hat)) --> Enum.AccessoryType.Hat | |
print(AssetTypeToAccesoryType(Enum.AssetType.Image)) --> Enum.AccessoryType.Unknown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment