R15 resizing / Objects

I’m currently working on a character resize-r and have encountered issues with making the Helmet shrink with the Player.

The size itself changes via the values in ones Humanoid, however I can’t find a work around to get the Helmet to reduce (or) grow in size with said Player, as the hat is made up of multiple parts I understand it may be an issue, but is it do-able?

Thanking you in advance.

6 Likes

Is the helmet a mesh part, model, or an accessory?

3 Likes

It’s a model itself, even tried turning it into an accessory but to no prevail.

2 Likes

Is the resizing of the character going to be continuous or will the character go from one size directly to another?

1 Like

Ideally continuous over a quick period,
an easy way to reference this is similar to the Ant-Man shrinking in Marvel films.

1 Like

Shrinking the model in real-time through a script is gonna require some math (that I don’t understand). If you want an idea of what mathematical procedures you need to do, read this post.

2 Likes

Should be doable in some way. What have you tried?
(Just looked at the link in XBearByte’s post… should definitely explore that first)

1 Like

If you want to make all parts in a model grow in size continuously, you have to start with a base, and multiply each part’s displacement from the base by whatever factor the model is growing by.

function resizeModel(model, a)
	local base = model.PrimaryPart
	for _, part in pairs(model:GetDescendants()) do
		if part:IsA("BasePart") then
			part.Position = base.Position:Lerp(part.Position, a)
			part.Size *= a
		end
	end
end

Note: you might have to reweld parts together.

function for tweening the model’s size:

local TweenService = game:GetService("TweenService")

local function tweenModelSize(model, duration, factor, easingStyle, easingDirection)
	local s = factor - 1
	local i = 0
	local oldAlpha = 0
	while i < 1 do
		local dt = task.wait()
		i = math.min(i + dt/duration, 1)
		local alpha = TweenService:GetValue(i, easingStyle, easingDirection)
		resizeModel(model, (alpha*s + 1)/(oldAlpha*s + 1))
		oldAlpha = alpha
	end
end

If you want to convert from scale to studs, divide your preferred length for a size property in your model by the current length, and use that for the scale.

33 Likes

You could just make a accessory of the helmet and upload it, edit the player’s humanoid description and apply it to the humanoid. No need for a really complex script in my eyes I guess. Uploading the helmet as an accessory makes it usable as accessory in the humanoid description and it should resize with the rest of the body. Take a look at this thread: New API For Equipping Assets on Humanoid Player Avatars

5 Likes