Error when scaling humanoids!

I’m working on a player tower for my tower defense game, but when meshes are scaled down, the accessories placements are wonky. Some are close to the right position, others are way far off. I’ve tried offsets on the SpecialMesh, but they don’t work with every accessory.

local tower = script.Parent

local function applyHumanoidDescription()
    local owner = tower:FindFirstChild("Owner")
    if owner then
        local username = owner.Value
        local success, userId = pcall(function()
            return game.Players:GetUserIdFromNameAsync(username)
        end)

        if success and userId then
            local humanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(userId)
            local humanoid = tower:FindFirstChildOfClass("Humanoid")
            if humanoid then
                local successApply, error = pcall(function()
                    humanoid:ApplyDescription(humanoidDescription)
                end)

                if successApply then
                    for _, accessory in ipairs(tower:GetChildren()) do
                        if accessory:IsA("Accessory") then
                            local handle = accessory:FindFirstChild("Handle")
                            if handle then
                                for _, part in ipairs(handle:GetChildren()) do
                                    if part:IsA("SpecialMesh") then
                                        local scaleFactor = 0.5
                                        part.Scale = part.Scale * scaleFactor
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end

applyHumanoidDescription()

Screenshot 2024-11-29 172154
Screenshot 2024-11-29 181425

from what i can tell, you’re not scaling the accessory’s AccessoryWeld, which is probably putting it into a wonky position

If the humanoids are under a model, you can scale the entire model directly by using model:ScaleTo(2)

reference:

1 Like

This worked; thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.