local function onInput(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode == Enum.KeyCode.C then
if not isCrouching then
isCrouching = true
-- activates crouching here
humanoid.WalkSpeed = 8
hrp.Running.PlaybackSpeed = 1
ts:Create(camera, TweenInfo.new(0.3), {FieldOfView = 60}):Play()
crouch_idle_animation:Play()
else
isCrouching = false
-- deactivates crouching here
humanoid.WalkSpeed = 16
hrp.Running.PlaybackSpeed = 1.55
ts:Create(camera, TweenInfo.new(0.3), {FieldOfView = 70}):Play()
crouch_idle_animation:Stop()
crouch_running_animation:Stop()
end
end
end
local function onRunning(speed: number)
if speed > 0 then
-- is moving
if isCrouching then
crouch_idle_animation:Stop()
crouch_running_animation:Play()
end
else
-- is not moving
if isCrouching then
crouch_running_animation:Stop()
crouch_idle_animation:Play(0.3)
end
end
end