Is there a relatively simple way to create a toggle crouch?

I’m a beginner game developer and I need a way for my first person controller or character to crouch by toggling and not holding down a button. I’ve tried different things but if the player is holding anything in their hands the game objects become stretched and warped while crouched. I figure that there must be a somewhat easy solution to this problem considering how many first person 3D games exist where the player can crouch and hold an object at the same time. I just have no idea what it is.
using UnityEngine;

public class CrouchController : MonoBehaviour
public Transform playerCamera; // Reference to the player camera
public float standingHeight = 2f; // Height of the player when standing
public float crouchHeight = 1f; // Height of the player when crouching
public float crouchSpeed = 5f; // Speed of crouching transition

private CharacterController characterController; // Reference to the CharacterController component
private float originalCameraHeight;              // The original height of the player camera
private Vector3 originalCameraLocalPosition;     // The original local position of the player camera
private bool isCrouching = false;                // Flag to track crouching state

private void Start()
    characterController = GetComponent<CharacterController>();
    originalCameraHeight = playerCamera.localPosition.y;
    originalCameraLocalPosition = playerCamera.localPosition;

private void Update()
    // Check for crouch input (e.g., "C" key)
    if (Input.GetKeyDown(KeyCode.C))
        ToggleCrouch(); // Toggle crouch on "C" key press

private void ToggleCrouch()
    isCrouching = !isCrouching;

    float targetHeight = isCrouching ? crouchHeight : standingHeight;

    // Smoothly lerp the character controller height to the target height
    float t = 0f;
    while (t < 1f)
        t += Time.deltaTime * crouchSpeed;
        characterController.height = Mathf.Lerp(characterController.height, targetHeight, t);

        // Calculate the new camera position relative to the character controller
        Vector3 newCameraLocalPosition = originalCameraLocalPosition;
        newCameraLocalPosition.y -= (standingHeight - targetHeight) * 0.5f;

        // Smoothly lerp the camera local position to the new position
        playerCamera.localPosition = Vector3.Lerp(playerCamera.localPosition, newCameraLocalPosition, t);

        // Exit the loop if the transition is almost complete
        if (Mathf.Abs(characterController.height - targetHeight) < 0.01f)


HI! Can you post the code so we can find the problem?