Change player's size when pressed a key

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

how do i fix the ugly red lines

Try the edited script again, it should be fixed

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

part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if Humanoid.HeadScale.Value > MinSize 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)

this for shrink, is it good?

That should work? If it doesn’t then it’s probably something having to do with the loops

uhh ima forget about the loop XD it no works

You sure? Are you getting anything from your Output?

nope everything have no error ;-;