After adding gravity I can't run and walk faster

Hey, I’m trying to make move script but it seems impossible to me because I stared at code for like an hour I even rewrote it but same problem. It appears that after I added gravity and groundcheck things, my character cant run or even walk at set speed (he is moving very slow). Can someone please help me with it please cuz’ I’m lost

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    //VARIABLES
    [SerializeField] private float moveSpeed;
    [SerializeField] private float walkSpeed;
    [SerializeField] private float runSpeed;

    private Vector3 moveDirection;
    private Vector3 velocity;

    [SerializeField] private bool isGrounded;
    [SerializeField] private float groundCheckDistance;
    [SerializeField] private LayerMask groundMask;
    [SerializeField] private float gravity;

    //REFERENCES
    private CharacterController controller;

    private void Start()
    {
        controller = GetComponent<CharacterController>();
    }

    private void Update()
    {
        Move();
    }

    private void Move()
    {
        isGrounded = Physics.CheckSphere(transform.position, groundCheckDistance, groundMask);

        if(isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        float moveZ = Input.GetAxis("Vertical");

        moveDirection = new Vector3(0, 0, moveZ);

        if(isGrounded)
        {
            if(moveDirection != Vector3.zero && !Input.GetKey(KeyCode.LeftShift))
            {
                Walk();
            }
            else if(moveDirection != Vector3.zero && Input.GetKey(KeyCode.LeftShift))
            {
                Run();
            }
            else if(moveDirection == Vector3.zero)
            {
                Idle();
            }

            moveDirection *= moveSpeed;
        }


        controller.Move(moveDirection * Time.deltaTime);

        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);

    }

    private void Idle()
    {

    }

    private void Walk()
    {
        moveSpeed = walkSpeed;
    }

    private void Run()
    {
        moveSpeed = runSpeed;
    }

}

Unfortunately, starting at code is less effective that debugging the code. Before you ask someone else to debug it for you, you should clarify what have you done to narrow it down so far.

You can do the above including temporarily removing things (like your ground-check) to see which part is causing the issue even if you don’t understand the why. Narrowing it down yourself is the most important first step before asking others because nobody here has access to your project.

I found the problem and managed to solve it. I was in ends but it was some floor problem rather then code error.
I recorded this video to show what I mean
https://www.youtube.com/watch?v=xfxgwmuPQsA

Then I would ask that in the future, you come back and mention that on your post.

Thanks.