Okay. Here is what the code for the gravity and jumping looks like now:
`` velocity.y = velocity.y - (gravity * delta) if not is_on_floor() else 0.0 #This is the gravity code!
var is_jumping = is_on_floor() and Input.is_action_just_pressed("jump")#Checking if the player pressed jump
if is_jumping:#If player press jump, the player jumps.
velocity.y = jump
slide = 3 if dir_input or not is_on_floor() else 0 #the controller won't slide if it's not moving or not in the air!
velocity = move_and_slide(velocity,Vector3.UP,true,slide,deg2rad(45))``
Everything is working fine for the most part. I do still get unintentional jumps but, it's no longer common and it's no longer. Thanks. I think I know what the other culprit could be and I'll try to fix it. I'll be right back to tell you what's up.