Resizing Player Character

Hi,

Im trying to resize my shark character model. its a custom model that i’ve made on blender. and is a meshpart. Ideally I’d want to resize the whole character model but from what I read you can’t resize the scale of the character model itself. So i’ve tried to resize the meshpart. However when I resize it in studio and get the correct proportions, the same measurements aren’t proportionate when used in a script to resize the shark.

Essentially I just want to resize the shark proportionally and keep its shape for the player. What would be the best way to do it. Here’s how i’ve gone about it currently.

local sharkModel = character
local scaleFactor = 2 – Desired scaling factor

					-- Function to scale CFrame uniformly
					local function scaleModel(model, factor)
						local primaryPart = model.PrimaryPart -- You need to set a PrimaryPart for the model in the properties
						local originalCFrame = primaryPart.CFrame

						for _, part in pairs(model:GetChildren()) do
							if part:IsA("MeshPart") then
								-- Scale the size of each part
								part.Size = part.Size * factor

								-- Adjust the position of the parts to maintain relative positioning
								local relativeCFrame = primaryPart.CFrame:toObjectSpace(part.CFrame)
								part.CFrame = originalCFrame * CFrame.new(relativeCFrame.p * factor) * relativeCFrame - relativeCFrame.p
							end
						end
					end

image

i think you can do Model:ScaleTo(scaleNum)

Set a PrimaryPart for the model also use ScaleTo

local function resizeModel(model, scaleFactor)
    local primaryPart = model.PrimaryPart
    if not primaryPart then
        warn("Model has no PrimaryPart set!")
        return
    end

    local currentPivot = model:GetPivot()
    local newCFrame = currentPivot * CFrame.new(0, (scaleFactor - 1) * primaryPart.Size.Y/2, 0)
    model:ScaleTo(scaleFactor)
    model:PivotTo(newCFrame)
end

local sharkModel = character:WaitForChild("Shark") -- for example your meshaprt tho
local scaleFactor = 2 
resizeModel(sharkModel, scaleFactor)

Both answer worked well btw. I just previously read we couldn’t use ScaleTo with custom avatars thats why I hadn’t tried. Thanks a lot!

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