Hello Guys
I’m currently trying to implement some 3D shoes we would like to use as a skin in our games.
I’ve searched quite a bit about layered clothing and wrote a decent script with 2-3 possible implementations but still none that solves my problem.
Implementation 1 – results in cutting out the player’s feet and not really replacing with the new mesh
local char = player.Character
local hum = char.Humanoid
local part = workspace.Manequins.ExpositorBotas.BotaL.Handle:Clone()
hum:ReplaceBodyPartR15(Enum.BodyPartR15.LeftFoot, part)
hum:ReplaceBodyPartR15(Enum.BodyPartR15.RightFoot, part)
Implementation 2 --The boots do attach to the R15 rig, but they are totally out of place. Switching to server side on runtime and moving the boots results in clipping between the character’s feet and the boots
local char = player.Character
local hum = char.Humanoid
for i,v in ipairs(char:GetChildren()) do
if v:isA("Acessory") then
if v.Handle:FindFirstChild("RightAnkleRigAttachment") then
v:Destroy()
end
if v.Handle:FindFirstChild("LeftAnkleRigAttachment") then
v:Destroy()
end
end
end
local clonedR = workspace.Manequins.ExpositorBotas.BotaL:Clone()
local clonedL = workspace.Manequins.ExpositorBotas.BotaL:Clone()
clonedL.Handle.Anchored = false
clonedR.Handle.Anchored = false
local leftAttachment = Instance.new("Attachment")
leftAttachment.Name = "LeftAnkleRigAttachment"
leftAttachment.Orientation = Vector3.new(0,90,0)
leftAttachment.Parent = clonedL.Handle
local rightAttachment = Instance.new("Attachment")
rightAttachment.Name = "RightAnkleRigAttachment"
rightAttachment.Orientation = Vector3.new(0,90,0)
rightAttachment.Parent = clonedR.Handle
hum:AddAccessory(clonedL)
hum:AddAccessory(clonedR)
Implementation 3 – Using Humanoid Description System, returns “Some Requested Assets were not available”
local function EquipSkin(player : Player, is3D : boolean, accType : String, AssetID : Int)
-- Get the HumanoidDescription from the UserId and clone
local playerHumanoidDescription = player.SkinConfig
if (is3D) then
-- Create an entry for the new layered clothing accessory:
local lcAccessoryData = {}
lcAccessoryData["AccessoryType"] = accType
lcAccessoryData["AssetId"] = AssetID
lcAccessoryData["Order"] = DefaultLayeredClothingOrder[accType]
-- SetAccessories expects a table of accessory entries:
local accessories = {}
accessories[1] = lcAccessoryData
-- Apply the new description to the humanoid:
playerHumanoidDescription:SetAccessories(accessories, --[[includeRigidAccessories = ]] true)
player.Character.Humanoid:ApplyDescription(playerHumanoidDescription)
else
if (accType == "pants") then
playerHumanoidDescription.Pants = AssetID
else
playerHumanoidDescription.Shirt = AssetID
end
end
player.Character.Humanoid:ApplyDescription(playerHumanoidDescription)
end
repl.Skins.EquipSkin.OnServerEvent:Connect(EquipSkin)