How do to this kind of movement system that some FPS games have?

Okay so I’m trying to make this kind of movement system that some FPS games have:

As you can see as I press any of the WASD keys, you’ll notice that the player slowly accelerates and slows down if I let go. If I am currently going forward and suddenly press S, you’ll notice that the player stops immediately then slowly accelerates backwards. Same goes for the remaining directions, you get the point.

I honestly am not sure on how should I do this kind of system. Any ideas on how should I do this? Any sample code to show me? I’d appreciate if you show it below in the replies.

4 Likes

You could take this from real life, when the movement keys are pressed, it doesn’t mean walk but it means accelerate, same with everything else and it’s inverses.

The character has a velocity, you speed up that velocity and speed down depending on directions. Going forwards and backwards is easier in real life than strafing side to side, so stopping faster to go backwards is by nature also velocity being stopped by opposite force.

Basically, player speed is ball, when you move you roll ball in that direction.

2 Likes

I found this module a couple days ago which is a local movement system based on source engine movement, hope it helps
https://www.roblox.com/library/6803581351/Bunny-Hopping-Movement

5 Likes

i ain gon get any like viruses or sum if i get this?

Its likely open source so just check the script…