I have a script that takes all of the player’s hairs and inserts them into the character. This is so that the player can have their avatar hairs with their custom characters. The problem I’m facing is that the accessories don’t have their proper mesh scaling and offsets. How can I get the accessories to have their respected scale and offset?
local IS = game:GetService("InsertService")
local Players = game.Players
local raceFolder = game.ServerStorage.Race
local playersFolder = game.ServerStorage.Players
Players.PlayerAdded:Connect(function(plr)
local statsFolder = playersFolder:WaitForChild(plr.Name):WaitForChild("Stats")
plr.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
local race = statsFolder:WaitForChild("Race").Value
if race then
local humdesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
local hairsStr = humdesc.HairAccessory
local hairIds = hairsStr:split(",")
local bodyColor = raceFolder[race]["Body Colors"]:Clone()
bodyColor.Parent = char
if hairsStr ~= "" then
for key, id in pairs(hairIds) do
local model = IS:LoadAsset(hairIds[key])
local accessory = model:FindFirstChildWhichIsA("Accessory")
if accessory then
local mesh = accessory:FindFirstChild("Mesh", true)
local specialMesh = accessory:FindFirstChild("SpecialMesh", true)
if mesh then
mesh.TextureId = ""
elseif specialMesh then
specialMesh.TextureId = ""
end
local handle = accessory:FindFirstChild("Handle", true)
handle.Color = raceFolder[race].HairColor.Value
hum:AddAccessory(accessory)
end
model:Destroy()
end
end
end
end)
end)