Problems With Wall Sliding

So I want to create WALL SLIDING but encountered a problem while trying to make it.

The issue is that when your falling the wall slide doesn’t work, demonstration shown in this picture:

I have tried solutions like

if Enum.HumanoidStateType.Freefall and WallSlide:IsPlaying == False then
    WallSlide:Play()
end

Since I dont want people just to copy and paste the code ill explain what my code does:

So it raycasts the player to a wall and if its 1 stud away from the wall it will play the animation and stop if its not 1 stud away

HELP IS VERY APPRECIATED

Have you tried changing your animation priority? That seems like the most likely culprit. I’d set the priority to “action” and see if that works. I think by default they are core so falling might override it.

I have set the priority to action BUT I left loop off so should I turn that on?

local WallSlideAnim = game.ReplicatedStorage.WallSlideAnim
local LoadedWallSlideAnim = Animator:LoadAnimation(WallSlideAnim)
LoadedWallSlideAnim.Priority = Enum.AnimationPriority.Action
LoadedWallSlideAnim.Looped = false

You should have the animation looped, and stop it whenever wall sliding is over

So that worked… kind of?

When I move the character using move tool the wall slide works, but when I jump off a part it doesn’t work

???

I have figured out the problem but dont know the solution.
The problem is that it only works when you are currently wall sliding and doing the animation