Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to detect if a player has fallen down?

local Humanoid = game.Workspace:WaitForChild("Red Nosed Seal").Humanoid
Humanoid.StateChanged:connect(function(old,new)
	print(old .. "    " .. new)
    if new == (1) then -- (A)
         --code
        Humanoid.Jump = true
    end
end)

Some help?

I've tried this but it gives the error of this http://prntscr.com/gf2xcp

2 comments

1

format your code

0

Done

1 answer

✓ Accepted answer

You would use the Enum HumanoidStateType followed by GetState(), as described here and here. Example:

local h = script.Parent:FindFirstChildOfClass("Humanoid") --wherever the humanoid is
	if h:GetState() == Enum.HumanoidStateType.Freefall then --if its falling
		print("Falling") --print falling
	end

or

local h = script.Parent:FindFirstChildOfClass("Humanoid")
	h.StateChanged:Connect(function(state)
		if state == Enum.HumanoidStateType.Freefall then
		print("Falling")
	end
	end)

This was written from scratch so I apologize if this didn't work. Please accept my answer if this helped!

3 comments

0

Trying it now, I'll let you know how it goes

0

Works, Thank you

0

No problem

This discussion is preserved as it was. New answers, comments, and votes are closed.