Hi, I want to convert a string to an enum for my code because I have to make customisable statues, and I want them to have customisable material. So, here is my code:
local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Statue = workspace.Statue.Char
local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Statue = workspace.Statue.Char -- Assuming "Statue" is a Model in the workspace
-- Player Item Functions
function Accessory(v, Material, Color) -- Accessory Function
local Handle = v:FindFirstChildWhichIsA("MeshPart")
Handle.TextureID = ""
Handle.Material = Material
Handle.Color = Color
end
function MeshPart(v, Material, Color) -- Part Function
v.Material = Material
v.Color = Color
end
function BaseAppearance(Morph, MorphHumanoid, Scale, Material, Color)
MorphHumanoid:WaitForChild("BodyHeightScale").Value *= Scale
MorphHumanoid:WaitForChild("BodyDepthScale").Value *= Scale
MorphHumanoid:WaitForChild("BodyWidthScale").Value *= Scale
MorphHumanoid:WaitForChild("HeadScale").Value *= Scale
for i, v in pairs(Morph:GetChildren()) do
if v:IsA("Pants") then
v.PantsTemplate = ""
elseif v:IsA("Shirt") then
v.ShirtTemplate = ""
elseif v:IsA("ShirtGraphic") then
v:Destroy()
elseif v:IsA("Accessory") then
Accessory(v, Material, Color)
elseif v:IsA("MeshPart") then
MeshPart(v, Material, Color)
end
end
MorphHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end
function StatueAppearance()
-- Variables
Character.Archivable = true
local CharacterMorph = Character:Clone()
local MorphHumanoid = CharacterMorph:WaitForChild("Humanoid")
-- Statue Body Appearance Variables
local Leaderstats_Material = Player:WaitForChild("Material").Value
local Scale = 15
local Material = (Enum.Material.)
local Color = Color3.new(0, 0.662272, 0.0386664)
-- Statue Position
CharacterMorph:SetPrimaryPartCFrame(Statue.PrimaryPart.CFrame) -- Set the character's position to match the Statue's position
-- Revert the statue to normal and set all the changes
Statue:ClearAllChildren()
CharacterMorph.Parent = Statue
BaseAppearance(CharacterMorph, MorphHumanoid, Scale, Material, Color)
Character.Archivable = false
end
StatueAppearance()
The place I want to edit is line 62-64. I need to do Enum.Material.(Whatever the player material is).
Please help, and thanks in advance.