twerq
|
  |
| Joined: 08 Jun 2013 |
| Total Posts: 1057 |
|
| |
|
twerq
|
  |
| Joined: 08 Jun 2013 |
| Total Posts: 1057 |
|
| |
|
|
| 22 May 2014 11:58 AM |
Easiest way to do this is to use a touch statement, and check the velocity at the time of impact.
Alt. of Jetta765214 |
|
|
| Report Abuse |
|
|
twerq
|
  |
| Joined: 08 Jun 2013 |
| Total Posts: 1057 |
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 22 May 2014 12:36 PM |
Torso...
get the magnitude from torso |
|
|
| Report Abuse |
|
|
twerq
|
  |
| Joined: 08 Jun 2013 |
| Total Posts: 1057 |
|
| |
|
twerq
|
  |
| Joined: 08 Jun 2013 |
| Total Posts: 1057 |
|
| |
|
transIate
|
  |
| Joined: 20 Jun 2013 |
| Total Posts: 2699 |
|
|
| 22 May 2014 04:26 PM |
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) c.Humanoid.FreeFalling:connect(function() if((p.torso-workspace['Part')<=17).magnitude then c:tAkeDamage(3); break; end; end); end); end); |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 04:33 PM |
I actually made my own fall damage script a while ago. Here, you can have it. Make sure it is a local script inside the starter pack.
death_height = 200 safe_height = 35 min_damage = 5
wait(1) player = game.Players.LocalPlayer torso = player.Character:WaitForChild("Torso") humanoid = player.Character:WaitForChild("Humanoid")
function height() return torso.Position.y end prev_height = height()
humanoid.FreeFalling:connect(function(active) if active then start_fall = height() prev_height = height() while active do wait() if height() > prev_height then prev_height = height() end end else fall_length = prev_height - height() if fall_length > safe_height then humanoid.Health = humanoid.Health - math.floor(((fall_length - safe_height + min_damage) / death_height) * humanoid.MaxHealth) end end end) |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 04:36 PM |
death_height is the height that will kill the player if they fall from that distance. safe_height is how far the player can fall without taking damage. min_damage is the minimum damage dealt to the player when they hit the ground.
This also takes into account the character's max health, so if you were to increase the character's max health but still wanted to do the same percentage of damage (for realism) then there is no problem there. |
|
|
| Report Abuse |
|
|