Rescaling character issue

I am creating a grow your “blank” game and need to scale the characters when the player eats “food”

a problem i ran into was the characters eyes are being pushed into the characters head and other things just aren’t proportionate

Details about the character
its one mesh
it contains a humanoidrootpart as the primarypart

what its supposed to look like all the time
image
but instead looks like this when i try to rescale it with my function
image

my function:

			local character = player.Character or player.CharacterAdded:Wait()
			for _, part in character:GetChildren() do
				if part:IsA("BasePart") or part:IsA("MeshPart") then
					part.Size += Vector3.new(Size.Value / 100000, Size.Value / 100000, Size.Value / 100000)
				end
			end
			Size.Changed:Connect(function()
				for _, part in character:GetChildren() do
					if part:IsA("BasePart") or part:IsA("MeshPart") then
						part.Size += Vector3.new(Size.Value / 100000, Size.Value / 100000, Size.Value / 100000)
					end
				end
			end)
			
1 Like

have you tried roblox scale system?

this system does alot now days it used to have some bugs but i think they worked them out it scales attachments ropes even humanoid speed which can be an issue but you can adjust for that or others

if you want to see it working my game Ant Colony Simulator uses this on the ants when they grow and also on the food when it is consumed

if its a part you need to scale just create a model instance add the part to it then scale it then remove the part back out works with groups of parts too

i tried ScaleTo() but its glitchy like resets the characters position

To scale the size you must multiply the original size by a factor. And also adjust the rig joints.

I ran this code for an R15 rig and it works well.
overlap hitbox.rbxl (89.7 KB)

local Char = script.Parent
local Size = Char:WaitForChild("Size")
local CurrentSize = Size.Value

local function Resize()
	local factor = Size.Value/CurrentSize
	CurrentSize = Size.Value
	
	for _,part in Char:GetChildren() do
		if part:IsA("BasePart") then
			part.Size *= factor
			for _,joint in part:GetChildren() do
				if joint:IsA("Motor6D") then
					joint.C0 = joint.C0.Rotation + joint.C0.Position*factor
					joint.C1 = joint.C1.Rotation + joint.C1.Position*factor
				end
			end
		end
	end
end

Size.Changed:Connect(Resize)

it doesn’t use motor6d’s
and also this doesn’t fix the issue
image

Here’s the code adjusted for bones.

local Char = script.Parent
local Size = Char:WaitForChild("Size")
local CurrentSize = Size.Value

local function Resize()
	local factor = Size.Value/CurrentSize
	CurrentSize = Size.Value
	
	for _,part in Char:GetChildren() do
		if part:IsA("BasePart") then
			part.Size *= factor
			for _,joint in part:GetDescendants() do
				if joint:IsA("Bone") then
					joint.CFrame = joint.CFrame.Rotation + joint.CFrame.Position*factor
				end
			end
		end
	end
end

Size.Changed:Connect(Resize)

rig scaling test.rbxl (112.4 KB)

you are scaling a humanoid character/npc?
and how is it messing up position? moving it up or down or totally different position?

i used what you said ScaleTo()

when you use that it glitches the character if you scale them while they’re moving

1 Like