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?
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.
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.
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