Change player's size when pressed a key

I know how to do keys thanks to the last topic, but how would i do the same for a player’s size?

2 Likes

Assuming you have UIS’s InputBegan Event working
Just change the Local Character Humanoid’s Properties & it should work, make sure that this is a LocalScript inside StarterPlayerScripts or StarterCharacterScripts

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local SizeMultiplier = 2

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

hmm it dosn’t seem to work inside the starterplayerscripts

Ok if StarterCharacterScripts doesn’t work just put it in the StarterPack

same thing ;-; it dosn’t work in starter player and starter pack

there is no errors in the output either

So apparently I’m dumb and forgot to change Key to Key.KeyCode

Try again, it should be fixed

which key do i change it to key.keycode?

The 2nd line, just change the Enum.KeyCode.E to whatever Key you want it to be


when i press e it gives me this

Inhale
Ok

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

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

I missed the value as well

1 Like

wait what if i make another this script but this time i make player smaller, is there something else i need to change? (it works perfactly now btw :partying_face:)

You can just change the SizeMultiplier variable to whatever you want, preferably something that’s less than 1 (Number > 1 basically)

what if like, i don’t want it to have no max size limits? (and the button no work again after i reset ;-; )

What do you mean by that?

Are you sure did you put it in StarterPack?

yep, i got myself into super big and reseted

Hm alright, could you try the updated script in StarterCharacterScripts? Also what do you mean by “no max size limits”? Like you just want the size to go as much as you want?

i mean yes size limits* what if i just want the player become 2 when press e and can’t get bigger?

I’m guessing you could just use an if statement to quickly check if 1 of the Humanoid’s Size properties are greater then 2? Probably something like this:

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 Humanoid.HeadScale.Value > MinSize then
        if Key.KeyCode == Enum.KeyCode.E then
            Humanoid.HeadScale.Value *= SizeMultiplier
            Humanoid.BodyDepthScale.Value *= SizeMultiplier
            Humanoid.BodyWidthScale.Value *= SizeMultiplier
            Humanoid.BodyHeightScale.Value *= SizeMultiplier
        elseif Key.KeyCode == Enum.KeyCode.Q then
            Humanoid.HeadScale.Value /= SizeMultiplier
            Humanoid.BodyDepthScale.Value /= SizeMultiplier
            Humanoid.BodyWidthScale.Value /= SizeMultiplier
            Humanoid.BodyHeightScale.Value /= SizeMultiplier
        end
    end
end)

do i do the same for the getting smaller ones? for example i want to make the max mini limit to 0.5