How friction works in roblox?

Hi guys.
I wanted to make a custom humanoid system, and had run into this problem:


It’s called friction. Character after jump slides back.
This’s part of code which tries to account for it:

local FloorFriction, FloorFWeight = Floor.CurrentPhysicalProperties.Friction, Floor.CurrentPhysicalProperties.FrictionWeight
local RootFriction, RootFWeight = self.Root.CurrentPhysicalProperties.Friction, self.Root.CurrentPhysicalProperties.FrictionWeight
local TotalFriction = (FloorFriction*FloorFWeight+RootFriction*RootFWeight)/(FloorFWeight+RootFWeight)
local VFade = math.max(1-TotalFriction*Delta*5, 0)
self.Root.AssemblyLinearVelocity = Vector3.new(Velocity.X*VFade, math.max(Velocity.Y, 0), Velocity.Z*VFade)
self.Root.AssemblyAngularVelocity *= (1-VFade*Delta)

What I did wrong?

2 Likes