Player friction when touching ground?

I have a system in StarterCharacterScripts that adds a bodyThrust force if you’re in the air, sort of like a form of airstrafing. Code is below

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local root = character:WaitForChild("HumanoidRootPart")
game:GetService("RunService").RenderStepped:Connect(function()
	if humanoid.FloorMaterial == Enum.Material.Air and humanoid.Health > 0 and humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
		if humanoid.MoveDirection ~= Vector3.new(0,0,0) then
			root:WaitForChild("BodyThrust").Force = Vector3.new(0,0,-1000)
		else
			root:WaitForChild("BodyThrust").Force = Vector3.new(0,0,-1350)
		end
	else
		root:WaitForChild("BodyThrust").Force = Vector3.new(0,0,0)
	end
end)

the only problem is, im trying to make this system so if you jump right when you land, your velocity saves like bunnyhopping. I was thinking maybe a jump buffering system so the player can still maintain velocity if they jump early enough?

3 Likes