in roblox if you jump while moving the humanoid automatically makes the character’s velocity intropolate to zero which is extremely inconvenient for momentum based games. so i found a script on the devforum that works great:
local oldVelPref = 140 -- Determines how strongly to maintain momentum, higher values maintain old velocity, but can cause wall sticking.
local airAcceleration = 2 -- Determines how quickly to accelerate in the air
local RunService = game:GetService("RunService")
local char = game.Players.LocalPlayer.Character
local Humanoid = char:WaitForChild("Humanoid")
local RootPart = char:WaitForChild("HumanoidRootPart")
Humanoid.FreeFalling:Connect(function(active)
while Humanoid:GetState() == Enum.HumanoidStateType.Freefall do
local oldVel = RootPart.AssemblyLinearVelocity
local dT = RunService.PostSimulation:Wait()
local curVel = RootPart.AssemblyLinearVelocity
-- Allows mid-air control
local moveVel = Humanoid:GetMoveVelocity()
local addVel = Vector3.new(
curVel.X > 0 and math.max(moveVel.X-curVel.X, 0) or math.min(moveVel.X-curVel.X, 0),
0,
curVel.Z > 0 and math.max(moveVel.Z-curVel.Z, 0) or math.min(moveVel.Z-curVel.Z, 0)
) * dT * airAcceleration -- Gradual acceleration
local pref = oldVelPref * dT
RootPart.AssemblyLinearVelocity = Vector3.new(
math.clamp(oldVel.X, curVel.X-pref, curVel.X+pref),
math.max(curVel.Y, -200),
math.clamp(oldVel.Z, curVel.Z-pref, curVel.Z+pref)
) + addVel
end
end)
but it allows for essentially zero air control. if anyone has any ideas on how to allow air control, please, please, let me know. its also really easy to test for yourself by just putting it into startercharacterscripts.