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

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

4 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:

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

2 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

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.

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

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.

2 Likes

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

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

1 Like

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

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.