Which humanoid state detects if a player is falling?

As far as I can tell, the freefall state only is used after the player is landed. I would like to be able to tell if a player is CURRENTLY falling, not if they have already fallen. If it doesn’t exist, I would appreciate if you could point me in the right direction of a performative, server-side replacement.

I believe that the freefall state is used when the player is currently falling, not after they have landed.

this code that i have only ragdolls the player after they land

hum.StateChanged:Connect(function(state)
	if state == Enum.HumanoidStateType.Freefall then
		if hum.Parent.HumanoidRootPart.AssemblyLinearVelocity.Y < -75 then
			ragdoll.ragdollplayer(player)
		end
	end
end)

That’s because Humanoid.StateChanged provides two parameters: the new state and the old state. You are checking the old state. An example use of detecting the new state would be something like so:

local function onStateChanged(old: Enum.HumanoidStateType, new: Enum.HumanoidStateType): nil
    if new == Enum.HumanoidStateType.Freefall then
        print("Player just started falling.")
    end
end

Humanoid.StateChanged:Connect(onStateChanged)

I included type annotation for a more detailed description.

1 Like

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