How should I try to make this fall damage script?

So I am really curious on how I could make fall damage script, but instead of killing the player, it “caps” at a certain damage after a certain distance fallen dealt to the player and gives the player a broken leg, hindering their movement?

How should I go about this, especially since scripting these specific kinds of things is not my strength.

Make the player take the damage as usual but if the damage value goes over a set number deal that amount of damage and not the damage value

Summary

If the damage is over a set amount, just deal the set amount of damage

You would make your casual fall damage script and add some stuff.

-Check for falling
-do tick to find fall time
-check if fall time is less than the max damage
-if it is, deal damage, if not, set it to max damage and break the player’s legs still
-:+1:

and this should be in a local script or server script?

(math | Roblox Creator Documentation)

Using math.clamp you can factor in the minimum height to take damage and the maximum. If it hits its max then break the users leg, if not do damage based on your other caps.

x,y,z = distance_fallen, 10(minimum studs fallen), 40(maximum studs fallen)
math.clamp(x, y, z)
If it returns below the minimum(10) dont do damage, if it returns above the maximum break the leg and do damage. Calculate the damage using math.clamp as well based on your desired needs.

tick() isn’t recommended to use anymore? yet you could use time()

Localscript in Startercharacterscripts I believe. If not, try server scripts.