I want to make a system where if you eat food you grow X amount of in or some foods x amount of ft or x amount of ft and in. How could I achieve this? I’ve tried to use the default scaling humanoid but that makes a player too big
The best way to do this is by editing the HumanoidDescription
and then applying it by using Humanoid:ApplyDescription()
.
This should allow you to edit the height and width as precisely as possible, even using decimals, so I don’t see how this could cause an issue. Keep in mind that the values aren’t in feet/inches, you would need to convert that yourself.
how would i make it so if a player is 5 height value (ft) and another is 6 then how would i make it look like they are 1 head difference in height or 1 ft pretty much
Like I said, HumanoidDescription
doesn’t use feet/inches as a way of measuring the size of a character. You would need to play around with the values in order to accurately convert them. I just played around with it for 2 minutes and found that if I change my character’s HeightScale
from 1 to 1.3, I become a whole head taller.
What could be the interval for this then?
You can see that my avatar editor matches the HumanoidDescription
values. This means that you need to find a way to convert the values, which are just multipliers as seen in the avatar editor, into feet/inches.
If increasing my avatar’s HeightScale
by 0.3 made it a whole head bigger, we can assume that increasing/decreasing the multiplier by 0.3 makes a difference of 1 foot, as you said. If the HeightScale
defaults to 1, we can assume that the default height of a player is 3.33 (1/0.3) heads/ft.
Now keep in mind, I don’t know the exact conversion of these values. I’m just going based off of your request of 1 head = 1 ft.
So would I need to change every scale value in the humanoid to 3.33?
Here’s a script that increases the size of the player’s character by a certain amount when they touch a food item. This script uses a BodySize object to control the size of the player’s character.
local food = script.Parent
local function eatFood(otherPart)
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
local character = player.Character
local humanoid = character:FindFirstChild('Humanoid')
if humanoid then
local bodySize = humanoid:FindFirstChild('BodySize')
if not bodySize then
bodySize = Instance.new('BodySize')
bodySize.Parent = humanoid
end
-- Change the scale value to control the size increase.
bodySize.Scale = bodySize.Scale + Vector3.new(0.1, 0.1, 0.1)
-- Remove or reposition the food item after it is eaten.
end
end
end
food.Touched:Connect(eatFood)
But this is touched, as a example.