Why isn't this scaling?

Hey there, my code is supposed to turn a statute into a big replica of the player but with some changes. Anyways, it was working but then after I tried making some other stuff with stats, it now doesn’t scale. The model changes and moves but doesn’t scale. Here is my code:

local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Statue = workspace.Statue.Char

local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Statue = workspace.Statue.Char -- Assuming "Statue" is a Model in the workspace

function ScaleModel(model, scale)
	for i, part in ipairs(Statue:GetDescendants()) do
		if part:IsA("BasePart") then
			part.Size = part.Size * scale
		end
	end
end

-- Player Item Functions

function Accessory(v, Material, Color) -- Accessory Function
	local Handle = v:FindFirstChildWhichIsA("MeshPart")
	
	Handle.TextureID = ""
	Handle.Material = Material
	Handle.Color = Color
end

function MeshPart(v, Material, Color) -- Part Function
	v.Material = Material
	v.Color = Color
end

function BaseAppearance(Morph, MorphHumanoid, Scale, Material, Color)
	MorphHumanoid:WaitForChild("BodyHeightScale").Value *= Scale
	MorphHumanoid:WaitForChild("BodyDepthScale").Value *= Scale
	MorphHumanoid:WaitForChild("BodyWidthScale").Value *= Scale
	MorphHumanoid:WaitForChild("HeadScale").Value *= Scale
	
	for i, v in pairs(Morph:GetChildren()) do
		if v:IsA("Pants") then
			v.PantsTemplate = ""
		elseif v:IsA("Shirt") then
			v.ShirtTemplate = ""
		elseif v:IsA("ShirtGraphic") then
			v:Destroy()
		elseif v:IsA("Accessory") then
			Accessory(v, Material, Color)
		elseif v:IsA("MeshPart") then
			MeshPart(v, Material, Color)
		end
	end
	
	MorphHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end
function StatueAppearance()
	-- Variables
	
	Character.Archivable = true
	local CharacterMorph = Character:Clone()
	local MorphHumanoid = CharacterMorph:WaitForChild("Humanoid")
	-- Statue Body Appearance Variables
	
	local Scale = 15
	local Material = Enum.Material.DiamondPlate
	local Color = Color3.new(0, 0.962463, 0.919234)
	-- Statue Position
	
	CharacterMorph:SetPrimaryPartCFrame(Statue.PrimaryPart.CFrame) -- Set the character's position to match the Statue's position
	-- Calculate the scaling factor based on the desired size of the Statue
	
	local ScaleFactor = Statue.PrimaryPart.Size.X / Character.PrimaryPart.Size.X -- Assuming the size is proportional in the X direction
	-- Apply the scaling to all parts of the cloned character
	
	ScaleModel(CharacterMorph, ScaleFactor)
	-- Revert the statue to normal and set all the changes
	
	Statue:ClearAllChildren()
	CharacterMorph.Parent = Statue
	CharacterMorph.HumanoidRootPart.Anchored = true
	BaseAppearance(CharacterMorph, MorphHumanoid, Scale, Material, Color)
	Character.Archivable = false
end

StatueAppearance()

The main parts are

  1. Line 17-23
  2. Line 70
  3. Line 78 & 81

Please help, and also I can provide additional info if you want. Also, if it works for anyone else please tell me cause ChatGPT said it should work, but I’m not sure. Thanks in advance.

I fixed it myself ooga booga ooga booga

Could you please write down what have you fixed? It’s a bad practice to just say “Guys i fixed it” because someone could potentially have the same issue. Please consider explaining what have you improved on your script/other things. Thanks!

Yes, sorry. It turns out anchoring the HumanoidRootPart was preventing the statue from scaling. I don’t know everything about it nor do I know why that happens because it breaks even if I anchor the HRP after scaling.

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