The title says it all. I have tried learning how to do this from free models but none of them work. I don't even know where to start
How do you create fall damage?
3 answers
local Fall_Damage_Begin = 10
local Fall_Damage_Scale = 1
local Player = game.Players.LocalPlayer
local Last_Y = Player.Character.Torso.Position.Y
function onFreeFall(active)
if (active) then
Last_Y = Player.Character.Torso.Position.Y
else
local y_diff = Last_Y - Player.Character.Torso.Position.Y --the difference between the fall start position and the fall end position
if (y_diff > Fall_Damage_Begin) then
local damage = (y_diff - Fall_Damage_Begin) * Fall_Damage_Scale --damage is based on the extra fall distance after Fall_Damage_Begin, and multiplied by Fall_Damage_Scale
Player.Character.Humanoid:TakeDamage(damage) --using the TakeDamage() method means that with a forcefield, the player won't take damage
end
end
end
Player.Character.Humanoid.FreeFalling:connect(onFreeFall)
This may work. I havent tested it, but it should. Let me know if it does.
4 comments
This didn't work.
Are you using R15?
Sorry for "Necroposting" but i think you can change torso to humanoidrootpart.
Change Torso to UpperTorso or LowerTorso accordingly. this should work with new rigs.
Thank you so much TickTockTheory!
I was able to use your code and tweak it a bit. I tested it in studio and worked great! This is for a R15 rig
local Fall_Damage_Begin = 10
local Fall_Damage_Scale = 1
local me = script.Parent.Name
local Player = game.workspace:FindFirstChild(me)
local myTorso = Player:WaitForChild("UpperTorso")
local Last_Y = myTorso.Position.Y
function onFreeFall(active)
if (active) then
Last_Y = Player.UpperTorso.Position.Y
else
local y_diff = Last_Y - Player.UpperTorso.Position.Y
if(y_diff > Fall_Damage_Begin) then
local damage = (y_diff - Fall_Damage_Begin) * Fall_Damage_Scale
Player.Humanoid:TakeDamage(damage)
end
end
end
Player.Humanoid.FreeFalling:connect(onFreeFall)
If ur to lazy to script there is a Fall Damage plugin https://web.roblox.com/library/199233141/Fall-Damage-Plugin
2 comments
humanoid.FreeFalling or humanoid.FallingDown fire a whileloop that adds while they fall and when they stop they take dammage
Doesn't work for R15 rigs.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I think I would do it via raycasting a ray from a player's torso downwards. You could get a distance and then check if the player's jumping or performing a normal activity. If they're not though and the distance is > the jump distance then you could create an equation to determine how much damage to make them take.