Hello Developers,
I’m currently creating a movement system but I am having troubles understanding on how to keep the players momentum after they land. I’ve provided my current code as well as a video example of the system:
local Jump = function()
local Height = HumanoidRootPart.Position.Y + Humanoid.JumpPower^2 * 2 / (2 * game.Workspace.Gravity) - 1
wait(0.1)
repeat
local LookVector = Character.Head.CFrame.LookVector * 2200
if HoldingS then
LookVector = -LookVector
end
if HumanoidRootPart.Position.Y < Height then
Gravity.Force = Gravity.Force + LookVector
else
if Gravity.Force.Y >= 0 then
Gravity.Force = Gravity.Force - Vector3.new(-1, 0 - 1)
else
Gravity.Force = Vector3.new(0, 1000, 0)
end
end
wait()
Gravity.Force = Vector3.new(0, 1000, 0)
until Humanoid.FloorMaterial ~= Enum.Material.Air
end