Advanced landing animations

Advanced laning animations. What im meaning by this is nased on the distance the player has fallen it will play a different animation.


Example if the player fell 5 studs a normal land animation where the player just simply goes down slightly and goes back up to the normal position. Not extreme but like what someone would do at a small fall

Another example is 7-9 studs a slightly more worse fall that will deal damage but also will play a different animation for it. Like almost fall over but is fine and gets all the way back up to idle

Second last example is 10-17 studs a heavy fall where the player just falls over and stays there for a second before getting up dealing a lot of damage. But the animation is different.

And for the last example is 20-Above studs a deadly fall where a death animation plays and kills the player.

Im not asking for animations but how i can go about making the script or help on making it.

Make 3 animations for the different distances, listen for updates for MaterialFloor on the character and if its either air or nil (forget if its just air) send a raycast out the players feet and get the distance from the ground below them and figure out how far it is then play the animation accordingly when the MaterialFloor changes again to anything else