I only mentioned it twice, but here is the code for it:
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 Player_Material = Player:WaitForChild("Material").Value
local Scale = 15
local Material = Enum.Material[Player_Material]
local Color = Color3.new(Player:WaitForChild(R.Value, Player.G.Value, Player.B.Value))
-- 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()
Well I mean but it’s really scuffed and it caused a few bugs. And by a few I mean a single bug–it says CorrodedMetal is not a member of Enum.Material. Thanks for pretty much writing my entire code though.
local function stringToEnum(enumType, stringValue)
local enumItems = Enum[enumType]:GetEnumItems()
for _, enumItem in ipairs(enumItems) do
if enumItem.Name == stringValue then
return enumItem
end
end
return nil
end
local enumType = "Material"
local stringValue = "Plastic"
-- Enum.Material.Plastic
local enumItem = stringToEnum(enumType, stringValue)
if enumItem then
print("Enum item found:", enumItem.Name, enumItem.Value)
else
print("No matching Enum item found.")
end
local function stringToEnum(enumType, stringValue)
local enum = Enum[enumType]
if enum then
return enum[stringValue]
end
return nil
end
local StatsTable = {
["Money"] = {
Type = "IntValue",
StartValue = 0,
Parent = "leaderstats"
},
["Fans"] = {
Type = "IntValue",
StartValue = 0,
Parent = "leaderstats"
},
["Color"] = {
Type = "Color3Value",
StartValue = Color3.fromRGB(255, 255, 255),
Parent = "leaderstats"
},
["Material"] = {
Type = "Material",
StartValue = "CorrodedMetal",
Parent = "leaderstats"
},
stringToEnum("Material", "CorrodedMetal")
}
and it says:
19:46:39.460 Type is not a valid member of "Enum.Material.CorrodedMetal" - Server - ModuleScript:26
this is modulescript:
local StatsHandler = {}
function StatsHandler.AddInstance(Path,InstanceType,Value,Name)
local SunkistOrange = Instance.new(InstanceType,Path)
SunkistOrange.Name = Name
if (InstanceType == "Folder") then
return SunkistOrange
end
SunkistOrange.Value = Value
return SunkistOrange
end
function StatsHandler.AddFromTable(Table,Player)
local Sun = {}
for Name,EachStat in Table do
local a = Instance.new(EachStat["Type"],Player:FindFirstChild(EachStat["Parent"]))
a.Name = Name
a.Value = EachStat["StartValue"]
table.insert(Sun, a)
end
return Sun
end
return StatsHandler
I just realised I have a much easier way to do all this and sorry for wasting your time you deserve like 10 solutions but here is your well deserved solution.