How do i make momentum pull the player foward a little after they have stoped running

I’m trying to make a movement system and i want to make it so that the momentum from when the character is running pulls the character forward a little after they have stopped running.

4 Likes

Well, first you’ll need to detect when they stop running, once you do that you have a couple options
either

Character.HumanoidRootPart.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 100 -- Change number for increase of distance

or

local BV = instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity =  Character.HumanoidRootPart.CFrame.LookVector * 25
BV.Parent = Character.HumanoidRootPart
game.debris:AddItem(BV, 0.25)

I’d use the first options preferably
Also .Velocity is apparently deprecated (Should still work though) either use that or AngularVelocity

1 Like

thanks now i understand but now i’m having trouble detecting if the player has stopped running I’ve tried renderstepped(which runs a bajilion times when the player stopped moving)and Humanoid Properties like ChangedState and Running but apparently after the player has stopped running the state is still “Running”
image
You can see renderstepped running alot and the StateType still being running while i’m standing still

if humanoid.MoveDirection.Magnitude == 0 then -- The player has stopped moving
1 Like

For some reason it only checks once which is when the player spawns and does not check to see if the player is moving or not again

The script is being told to execute once, that is the problem.

humanoid.Changed:Connect(function()
if humanoid.MoveDirection.Magnitude == 0 then -- The player has stopped moving
end
end)

That script will fire everytime the humanoid changes. Including MoveDirection. That should work.

1 Like

thanks alot it works :+1: im still relatively new to scripting so i didnt know about humanoid.Changed

1 Like