Custom Physics Friction Not Working

Now I’m working on a 2D sonic engine in playcanvas, and I’m trying to get friction to work. The player entity does stop, but when you try to move after you’ve stopped, the player entity feels like there’s a force repelling against it (which is probably the friction function working while the movement function is trying to play). I’ve tried many different ways to try and fix this, but I can’t seem to find a solution. What’s the solution to my problem?

Editor Link: https://playcanvas.com/editor/scene/860574
PlayerPhysics Script (Custom Physics Script): https://playcanvas.com/editor/code/660031?tabs=26970319