I can't move while pressing CTRL?

Okay so I have a character here, it’s a custom character. You can control it with basic movements like WASD controls. Now I added some additional controls:

  • Left Shift: To run/sprint
  • Left CTRL: To crouch/crawl or walk while crouched

The issue is I can move when I hold shift to run while holding w at the same time. Now when I hold CTRL it does work. But it only forces my character to crouch. It only plays the crouch animation. When I try to move by pressing W while holding CTRL, it won’t let me like the character is stuck or something. I checked the properties, the humanoid properties look fine. The WalkSpeed is not 0.

Sometimes I managed to move while crouching, which is a weird bug I don’t know what’s causing it.

Here’s a footage of the problem: 2021-06-09 21-08-18

If you take a look at the video, look closely on the output, it prints what I pressed.
It does print that CTRL is being held or pressed down. There, the crouch works, the animation plays but I can’t move while pressing CTRL and W at the same time. Unless I let go of the CTRL, it would cancel the crouch and I’ll be able to move again.

Sometimes, I sprint around then jump then press CTRL to crouch and I’m still holding w, now I can move, I am finally crawling (or crouch walking). The bug is weird, isn’t it?

This bug is confusing. It lets me move if I jump then crouch and hold W at the same time when I land on the ground. But if I’m not moving at all, I press CTRL to crouch then press W while holding CTRL, it just won’t let me.

If you have suggestions, questions, ideas, let me know in the replies below. :slight_smile:


Contact me in discord: CLOWN#8679

Have you tried giving the walk speed when it crouch a lil slower? It could be you setting it as 0 when you want it to crouch.

1 Like

He said he checked the walkspeed. But still it might be that.

1 Like

The only thing the crouch code modifies is the HipHeight of the humanoid.

For the sprint, it only modifies walkspeed. Nothing else.

1 Like

That’s weird, just to make sure, add a line of code that set the walk speed to your desired speed for crouching like after you set the hip height.

1 Like

@huanwz I’ll try that later and let you know if it works or not.

@huanwz Nope still doesn’t work. The bug is still there. It does make me crouch walk at a slow speed but I can’t move if I press CTRL first then W.

When it comes to FPS games, you hold CTRL to crouch and crawl. That’s what I’m trying to implement in my code but there’s a bug that let my character move if I crouch first then press W. Unless I jump then crouch, it will let me.

Alright so the CTRL code was working the entire time. It only doesn’t work in studio but when I tested it in the actual roblox client (Roblox Player).

1 Like