So this localscript inside of startercharacterscripts is meant to resize the character's HumanoidRootPart and make it really short on the Y scale, which is supposed to act kind of like a crouch.
local Player = game.Players.LocalPlayer local Character = Player.Character local CharAnimation local hrp = Character;FindFirstChild("HumanoidRootPart") game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.C then hrp.Size = Vector3.new(script.Parent.Size.X,script.Parent.Size.Y - 1.9,script.Parent.Size.Z)
So basically, it's supposed to resize the HumanoidRootPart when the player presses "C", but it deosn't do that. please help
Before you start, make a RemoteEvent in ReplicatedStorage called "Crouch"
This is the localscript that is located in StarterPlayerScripts:
local player = game.Players.LocalPlayer local uis = game:GetService("UserInputService") local rp = game:GetService("ReplicatedStorage") local crouchevent = rp:WaitForChild("Crouch") uis.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.C then crouchevent:FireServer() end end)
This is the script thats located in ServerScriptService:
local rp = game:GetService("ReplicatedStorage") local crouchevent = rp:WaitForChild("Crouch") crouchevent.OnServerEvent:connect(function(player) local character = player.Character local hrp = character.HumanoidRootPart local hrpy = hrp.Size.Y - 1.9 hrp.Size = Vector3.new(hrp.Size.X, hrpy, hrp.Size.Z) end)