How to detect when player lands

Hello!
I’ve been working on my game and I’m tyring to implement a system where;
if the player lands, an animation plays.

I have no idea how to do this, as I am a new scripter.
(I am not looking for full scripts, only scripts that tell me when the player has landed)

Any help is appreciated!

3 Likes

you could detect when the Humanoid state changes or when their Y velocity changes from - to 0 or positive

Check if Humanoid.FloorMaterial ~= “Air”

Humanoid.FreeFalling:Connect(function(active)
	if active then
		-- Falling
	else
		-- Landed
	end
end)
2 Likes

I was asleep. I will try all of these

That would just make it infinitely play.

Yay, this works. It plays even when the smallest of jumps, but its still something.

You can use @Vikram200526’s idea with a small tweak

Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
  if Humanoid.FloorMaterial ~= Enum.Material.Air then
    print("Landed")
  end
end)

I said this wouldnt work. It prints “Landed” when I change a material. Such as changing from diamond plate to metal.

Oh true my bad, here’s the fix for that. But if FreeFalling works that does seem simpler :slight_smile:

local lastMaterial = Humanoid.FloorMaterial
Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
  local mat = Humanoid.FloorMaterial
  if mat ~= Enum.Material.Air and lastMaterial == Enum.Material.Air then
    print("Landed")
  end
  lastMaterial = mat
end)
2 Likes

This also works. I would mark this as solution if I could mark 2 solutions.

1 Like

That was what i mean by using humanoid.FloorMaterial i just didnt have the time to write a script, just gave an idea xd

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.