How do you change the size of 1 body part by pressing one certain key

I wanted to make it so that when you press down a key for example the key Q and wanted it so that only one part of the body is increased for example only the Left Arm and when you press the required key again the part goes back to normal. (Increased as in its more longer in length wise.)

I tried using Remote Event but for some reason it wasn’t working.

Is there any way I can do this.

You can set up a UserInputBegan event and check for whenever the Q key is pressed. If the key is pressed, then you fire a remote event to the server.

On a ServerScript, you would receive that remote event call, and make a variable for the player’s character that was passed through. Then you could just change the X, Y, Z size values of a part of the character

For example:

Q Key is pressed and the remote event is fired to the server.

ServerScript in ServerScriptService receives the event and creates a variable for the player’s character.

Using a line like Character[“Left Leg”].Size = Vector3.new(X, Y, Z) should do the job.

1 Like

I used the following code and it didn’t really workout.



There was no error warnings but when i pressed the Q key nothing happened.

[Here is the code =
StarterGui


local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown")

UIS.InputBegan:Connect(function(input)
	
	if input.KeyCode == Enum.KeyCode.Q then
		KeyDownEvent:FireServer()	
		
	end
end)

ServerScript

local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown")

KeyDownEvent.OnServerEvent:Connect(function()
	local player = game.Players.LocalPlayer
	local Larm = player.Character.LeftArm
	player.Larm.Size = Vector3.new(1,5,1)
end)

UserInputService only works on local scripts. Change the normal script in starterGui to a localscript.

2 Likes

You can’t use game.Players.LocalPlayer on a server script. The event automatically sends the player’s info with it, so this is what your serverscript should look like instead:

local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown")

KeyDownEvent.OnServerEvent:Connect(function(player)
	local Larm = player.Character.LeftArm
	player.Larm.Size = Vector3.new(1,5,1)
end)

Also make sure you pass through the player instance in your serverscript event function by typing player inside the parentheses, then instead of using the localplayer (which can’t be accessed in a serverscript anyways), use this to get your character:

local KeyDownEvent = game:GetService("ReplicatedStorage"):WaitForChild("KeyDown")

KeyDownEvent.OnServerEvent:Connect(function(player)
	local character = player.Character
	local Larm = character.LeftArm
	Larm.Size = Vector3.new(1,5,1)
end)
1 Like


Here is the result I got after changing the script in StarterGui to local script and changing the serverscript

Cant access the Arm being R6

Its because the arm has a space in the name so do it like this player.Character[“Left Arm”]

thanks but

ok now its fixed


KeyDownEvent.OnServerEvent:Connect(function(player)

local Larm = player.Character["Left Arm"]

Larm.Size = Vector3.new(1,5,1)

end)

I found the issue your saying player.Larm it should be Larm.Size

1 Like

Is there also a way i can change the orientation of the arm when the key is pressed, if yes how?

There is but i never tried so i cant tell how

Also how do you want the arm to be oriented

90 degrees in X axis
image

You would put the same thing as what you did with Size, but replace size with orientation and then in the first part of the vector3 value, put 90 and everything else 0.