How can I create a fall damage system that plays an animation when the player lands?

Hello,

Now let me get this straight - although the title says fall damage, I am not actually looking for something that will damage the player. What I am asking is how I can create a system similar to fall damage that will play an animation when the player hits the ground after a long fall. Say you jump off a 10 foot wall in real life. You would obviously collapse to your knees or have some reaction, and I’m positive you would not keep running like nothing just happened.

Thanks in advance,
Kite

Here’s a list (in order).

  1. HumanoidStateType | Roblox Creator Documentation
  2. Humanoid | Roblox Creator Documentation

Start a timer when the humanoid’s state is in Freefall, and stop it when the humanoid’s state is Landed.

why need a timer? just play the animation when newstate is landed

This should answer your question, I’m sure you didn’t read everything he said.

1 Like

I’m not sure about the animation but there are some really good plugins for fall damage

local t = nil 
local falltime = nil
local humanoid = game.Players.LocalPlayer.Character.Humanoid

humanoid.StateChanged:Connect(function(oldstate , newstate) 
if newstate == "Freefall" then
t = tick()
else if newstate == "Landed" and t then
falltime = tick() - t 
end
end) 

Because my pc is not available to me right now I am not really able to test if this really works but you can try it out if you get it.

2 Likes

Thank you all for the replies, but nothing seems to be working. I will continue to read more about this.

Because your knees don’t buckle from a short hop or normal jump.

1 Like

you can use the code @octanagolamen posted for using humanoid states, however you can use use the velocity’s y to check how fast the player fell.

Thanks for the reply. This is my current Local Script located in StarterCharacterScripts. It does not seem to be working, do you know what I am doing wrong?

local t = nil
local falltime = nil
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local anim = Instance.new(‘Animation’)
anim.AnimationId = ‘rbxassetid://7286026184’
local loaded = humanoid:LoadAnimation(anim)

humanoid.StateChanged:Connect(function(oldstate , newstate)
if newstate == “Freefall” then
t = tick()
else if newstate == “Landed” and t then
falltime = tick() - t
loaded:Play()
end
end
end)

Thanks in advance.