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