Shrinking/Changing Player Size with a Script

Hi there,my name is Leon and I am very new at scripting,I have been trying to change a player’s size when they touch a part with any of their body parts.
I have tried looking for videos for this,but I can’t seem to find them,if you could help me I would highly appreciate it!

My discord is: leon jeminaj#5916

14 Likes
local HS = Humanoid.HeadScale
local BDS = Humanoid.BodyDepthScale
local BWS = Humanoid.BodyWidthScale
local BHS = Humanoid.BodyHeightScale

HS.Value = HS.Value * 2
BDS.Value = BDS.Value * 2
BWS.Value = BWS.Value * 2
BHS.Value = BHS.Value * 2

You can change the scale of the player with the Scale properties in the Humanoid. The default scale size is 1. Remember that Roblox allows players to slightly modify their body proportions in Avatar selection, so if you plan to revert the player you will need to store their current values.

14 Likes

I inserted what you said into a script,but the ‘‘Humanoid’’ has got a red underline in it and when I try to step into the part it doesn’t change the size of my character :confused:

4 Likes

You need to get the player’s humanoid.
local Humanoid = Player.Character.Humanoid

5 Likes

local Humanoid = game.Players.Humanoid

local HS = Humanoid.HeadScale

local BDS = Humanoid.BodyDepthScale

local BWS = Humanoid.BodyWidthScale

local BHS = Humanoid.BodyHeightScale

local part = game.Workspace.Part

part.Touched:Connect(function(hit)

if game.Players:GetPlayerFromCharacter(hit.Parent)

then HS.Value = HS.Value * 2

BDS.Value = BDS.Value * 2

BWS.Value = BWS.Value * 2

BHS.Value = BHS.Value * 2

end

end)

This is what I used but it still doesn’t work,did I type something wrong?
I tried to say local Humanoid = Player.Character.Humanoid but it couldn’t find it so I wrote local Humanoid = game.Players.Humanoid

4 Likes

Why why you try to get the player’s Scale before they touch the part? Assuming this is a server script, you can only get the player once they touch the part.

local part = game.Workspace.Part

part.Touched:Connect(function(hit)
	local Humanoid = hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then
		Humanoid.HeadScale *= 2
		Humanoid.BodyDepthScale *= 2
		Humanoid.BodyWidthScale *= 2
		Humanoid.BodyHeightScale *= 2
	end
end)

Edit: Updated code to use the newly added compound assignments.

20 Likes

Thank you for this,I am new and you clearly know way more than me lol,the script works well but when I go giant it makes me way too big and it throws me out the map. Is there any function or solution to prevent a certain size?

2 Likes

All of this information you have asked for is very easy to find with a quick google search. You can make use of a debounce to limit how often the code runs.

To prevent getting too big, simply add an if statement, making sure the scale is below a certain value.

You’re not limited to the Scale * 2 that I gave in the example script. You can change the numbers how ever you want with basic math.

4 Likes

Thank you so much for your help,appreciate it a lot! :smiley:

2 Likes

I know this is an old post, but I recommend using assignment operator instead, like so: value *= 2 instead of value = value * 2

3 Likes

HeadScale is not a valid member of Player “Players.mlnitoon2”

2 Likes

In Studio, press Play, then copy the following from your player’s Humanoid:

image

Next, stop the game, and then paste them into your NPC’s humanoid. You might need to create a Model named “Status” too.

image

Next, insert a Script inside your NPC. I changed @MayorGnarwal 's code a bit. Thanks!
Script:

It should work. It’s not the best way of doing it, but it works.
You might experience this problem tho…

image

Sorry for pasting quite a lot of images into one reply.

5 Likes

what if i wanted to keep his proportions? like for example, a skinny avatar, going with the normal humanoid scales it will make it more chubby. i tried

edit: nvm i just found out lol

local x = .5 --resize factor
hum.BodyWidthScale.Value *= x 
hum.BodyDepthScale.Value *= x
hum.BodyHeightScale.Value *= x 
hum.HeadScale.Value *= x
1 Like

i wonder why it doesnt work on r6 but work on r15

because the BodyWidthScale and those things are a R15 Exclusive thing, R6 does not have those values