Change player's size when pressed a key

local UIS = game:GetService(“UserInputService”)
local Character = script.Parent
local Humanoid = Character:WaitForChild(“Humanoid”)
local SizeMultiplier = 0.5

UIS.InputBegan:Connect(function(Key, Chatted)
if Chatted then
return
end

if Key.KeyCode == Enum.KeyCode.Q and Humanoid.HeadScale.Value < 0.5 then
    Humanoid.HeadScale.Value *= 0.5
    Humanoid.BodyDepthScale.Value *= 0.5
    Humanoid.BodyWidthScale.Value *= 0.5
    Humanoid.BodyHeightScale.Value *= 0.5
end

end)

You could just implement another check if it’s both greater than & less than the Min/Max Sizes, I edited it btw

how do i make it so that the player gets smaller? is it like

if Key.KeyCode == Enum.KeyCode.Q and Humanoid.HeadScale.Value < 0.5 then
    Humanoid.HeadScale.Value *= 0.5
    Humanoid.BodyDepthScale.Value *= 0.5
    Humanoid.BodyWidthScale.Value *= 0.5
    Humanoid.BodyHeightScale.Value *= 0.5
end

end)

I guess you could just first check if the Scaling is Greater/Less than the Number, then check to see which key it detected

If your key is 1 of the correct keys, then it will either increase/decrease your Character’s Size (Edited it once again)

This would only make it visible for the player and not everybody though.
You would have to use a remote and set it on the server.

but i want the player decrease the size by 0.5 instead of 2(the mutiplyer)

Yes I’m aware, I’m just giving an example on how it works briefly

Making it visible to everyone though yeah you’d need to implement a RemoteEvent
for client/server transportation

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local MinSize = 0.5
local MaxSize = 2

local SizeMultiplier = 2

UIS.InputBegan:Connect(function(Key, Chatted)
    if Chatted then
       return
    end
    
    if Humanoid.HeadScale.Value < MaxSize and Key.KeyCode == Enum.KeyCode.E then
        Humanoid.HeadScale.Value *= SizeMultiplier
        Humanoid.BodyDepthScale.Value *= SizeMultiplier
        Humanoid.BodyWidthScale.Value *= SizeMultiplier
        Humanoid.BodyHeightScale.Value *= SizeMultiplier

    elseif Humanoid.HeadScale.Value > MinSize and Key.KeyCode == Enum.KeyCode.Q then
        Humanoid.HeadScale.Value -= 0.5
        Humanoid.BodyDepthScale.Value -=  0.5
        Humanoid.BodyWidthScale.Value -=  0.5
        Humanoid.BodyHeightScale.Value -=  0.5
    end
end)

emmmm at max size i can’t make it go down

Ok if this doesn’t work then Idk what else to do

O well lol ima try solve this by tweaking stuff, thanks for your help tho

1 Like

yaaay i figered it out :DDDDDDDDDDDDDDDD
but i made it so that when a player rouches the part it does the job. And other players will see the player becomes bigger :smiley:
heres wot i did

local part = game.Workspace.Part
local MaxSize = 2
part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if Humanoid.HeadScale.Value < MaxSize and Humanoid then
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
end

end)

took some of your knolage

1 Like

Ey, glad you worked it out! Although I would recommend adding a debounce to that script so that you don’t repeatedly increase in size:

local part = game.Workspace.Part
local DB = false
local MaxSize = 2

part.Touched:Connect(function(hit)
    local Humanoid = hit.Parent:FindFirstChild(“Humanoid”)
    if Humanoid.HeadScale.Value < MaxSize and Humanoid and DB == false then
        DB = true
        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
        wait(1)
        DB = false
    end
end)

how would i make it so that it grows back slowly, like wait 0.1 second between each 0.1 grow

i have a grow small block too,
heres the script
local part = game.Workspace.Bruh
local MinSize = 0.5
part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if Humanoid.HeadScale.Value > MinSize and Humanoid then
local HS = Humanoid.HeadScale
local BDS = Humanoid.BodyDepthScale
local BWS = Humanoid.BodyWidthScale
local BHS = Humanoid.BodyHeightScale

	HS.Value = HS.Value * 0.5
	BDS.Value = BDS.Value * 0.5
	BWS.Value = BWS.Value * 0.5
	BHS.Value = BHS.Value * 0.5
end

end)

You could put it through a loop, slowing increasing your size maybe?

local part = game.Workspace.Part
local DB = false
local MaxSize = 2

part.Touched:Connect(function(hit)
    local Humanoid = hit.Parent:FindFirstChild("Humanoid")
    if Humanoid.HeadScale.Value < MaxSize and Humanoid and DB == false then
        DB = true
        local HS = Humanoid.HeadScale
        local BDS = Humanoid.BodyDepthScale
        local BWS = Humanoid.BodyWidthScale
        local BHS = Humanoid.BodyHeightScale

    	for Loop = 1, 10 do
            HS.Value += 0.1
            BDS.Value += 0.1
            BWS.Value += 0.1
            BHS.Value += 0.1
            wait(.1)
        end
        wait(1)
        DB = false
    end
end)

And do the same for your shrink script as well

how do you increase the walk speed of the giant to 160 and jump power to 100(or 10 times the values)?

and this uhhh

R E D lines creeps me out

Y the code be formatted like that though

You could probably take the Player’s Total Mass & Multiply it by how much total there is, but I’m not certain

I believe you could look at this post:

this said in the down courner