I trying to make the character smaller when it spawns but sometimes it doesn’t make the head and accessories smalller if you rejoin multiple times
local function scale_char(char: Model, value: number)
local humanoid = char:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
local HumanoidDescription = char:FindFirstChildOfClass('Humanoid'):WaitForChild('HumanoidDescription')
--HumanoidDescription.DepthScale = value
--HumanoidDescription.HeightScale = value
--HumanoidDescription.WidthScale = value
HumanoidDescription.HeadScale = value
--HumanoidDescription.ProportionScale = value
char.Humanoid:ApplyDescription(HumanoidDescription)
for _, part in char:GetDescendants() do
if part:IsA("BasePart") then
part.Size *= value
end
if part.Name == 'Head' then
if part:FindFirstChildOfClass('SpecialMesh') then
part:WaitForChild('Mesh').Scale *= value
end
end
end
-- attaching parts
for _, motor in char.Torso:GetChildren() do
if motor:IsA('Motor6D') then
if game.ReplicatedStorage.Assets.small_r6.Torso:FindFirstChild(motor.Name) then
local new_motor = game.ReplicatedStorage.Assets.small_r6.Torso[motor.Name]:Clone()
new_motor.Parent = char.Torso
new_motor.Part0 = char.Torso
new_motor.Part1 = char[motor.Part1.Name]
motor:Destroy()
end
end
end
-- traversing exceptionally for accesories
for _, part in char:GetChildren() do
if part.ClassName == "Accessory" then
if part:FindFirstChild('Handle') then
part.Handle.Size *= value
if part.Handle:FindFirstChildOfClass('SpecialMesh') then
part.Handle:FindFirstChildOfClass('SpecialMesh').Scale *= value
end
if part.Handle:FindFirstChildOfClass('Attachment') then
part.Handle:FindFirstChildOfClass('Attachment').Position *= value
end
end
end
end
humanoid.HipHeight *= value
end
idk really what’s wrong in here