While some parts are hard coded into the game, creating a version that works with Roblox Humanoids shouldn’t be over the top. Your character is constantly accelerating when they’re moving based upon inputs you’re providing the controller.
Lets set some quick ground rules;
- v3 = Vector3
- X axis, -1 is left, 1 is right, 0 is stationary
- Y axis is our jump input, 1 is jump, 0 stationary
- Z axis is our forward/backward input, 1 is backward, -1 is forward, 0 is stationary.
So, lets say we want to move forward, we let our input be v3(0,0,-1). Our humanoid has a walkspeed of 16, so this is fairly simple to translate to say we want our humanoid to move at 16 units.
Our movement = v3(0, 0, -1) * Humanoid.WalkSpeed = v3(0, 0, -16)
Great! We’re now moving at 16 units! Lets do the same with going right!
Our movement = v3(1, 0, 0) * Humanoid.WalkSpeed = v3(16, 0, 0)
Again, awesome, still goign 16 units. But something funky happens when we combine the two.
Our movement = v3(1, 0, -1) * Humanoid.WalkSpeed = v3(16, 0, -16)
Whoa there, we aren’t going at 16 units anymore! We’re going juuuuust slightly too fast.
This, while not directly what you’re after, is an incredibly easy way of looking at this problem. You can simply tell your humanoid to increase WalkSpeed from your base walkspeed while your inputs result in this and your Humanoid is in the Jumping/FreeFalling State. And when we’re not, we simply iterate back down to our regular walking speed.
Is this a substitute for bunnyhopping? No, you’ll feel the difference in a big way, it will take some time to get used to. But it is a good introductory exercise when talking about this kind of thing.
Once you’ve got this down, start looking at the accelerate function and how it’s being called. Deconstruct it into lua, and then pair it with what you’ve got.
Edit: Apolgies, the end here is a bit naff, but I’ve got to leave for work. Might return later tonight to clean it up.