Okay, so I would like to create realistic character movement that accelerates and decelerates when you stop and start moving.
I have looked into other posts and came across this one: Simulating smoother character movement? but I cannot get the lerping to work.
Help would be INCREDIBLY appreciated
Take the players character and find its humanoid. Do a while loop that runs every certain amount of seconds until the player comes to a stop. Increase the humanoid walkspeed by 0.1 or whatever you want every time it runs through the while loop.
local player = game.Players.LocalPlayer
local playerMoving = false
local DefaultSpeed = 16 --set to whatever you want
local IncreaseSpeed = 1 --set to whatever you want
local function StartedMoving() --Call this function when your player starts moving
playerMoving = true
while true do
player.Character:WaitForChild("Humanoid").WalkSpeed += IncreaseSpeed
if playerMoving == false then
player.Character:WaitForChild("Humanoid").WalkSpeed = DefaultSpeed
local function StoppedMoving() --Call this function when your player stops moving
if playerMoving == true then
playerMoving = false
StartedMoving() --Called when player starts moving
--StoppedMoving() --Called when player stops moving
Now simply indicate when these functions should be called and you’re good to go. You can add extra if statements in the while loop like
local MaxSpeed = 30
If Humanoid.WalkSpeed < MaxSpeed then
--Increase the walkspeed but otherwise if its greater or = to maxspeed then
--It wont do anything and keep you from accelerating further.
So just figure out when you want to call the function for moving/accelerating and when you want to stop and you should be good. I suggest using runservice to check when player is moving or not.
I figured out how to make the module in the other post work, thanks for your help though!
Ah sorry to bump this but i was hoping you could share on how you got the old post’s system to function, i couldn’t figure out what was causing it to break, would really appreciate any replies