Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Detecting if a player is falling?

Asked by 4 years ago

This is a script inside StarterCharacter, a normal script. I'm trying to print something but for some reason this script isn't working. Any ideas?

1local Humanoid = script.Parent:WaitForChild("Humanoid")
2 
3Humanoid.StateChanged:Connect(function(PreviousState, NewState)
4    if NewState == Enum.HumanoidStateType.FallingDown then
5        print("falling")
6    elseif NewState == Enum.HumanoidStateType.Landed then
7        print("landed")
8    end
9end
0
I’ve edited the answer, try it out and see if it works. 1JBird1 64 — 4y
0
hello? 1JBird1 64 — 4y
0
use Run Service instead proROBLOXkiller5 112 — 4y
0
also you forgot to change end to "end)" at the end proROBLOXkiller5 112 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
01local Humanoid = script.Parent:WaitForChild("Humanoid")
02local RunService = game:GetService("RunService")
03 
04RunService.Heartbeat:Connect(function()
05    if NewState == Enum.HumanoidStateType.FallingDown then
06        print("falling")
07    elseif NewState == Enum.HumanoidStateType.Landed then
08        print("landed")
09    end
10end)

honestly i think this would work

but if it doesnt maybe you should check if the falling animation is playing instead

0
You don't use falling down. You use free falling ssgmalachi 52 — 4y
0
I went into the animation script and it's literally as easy as: Humanoid.FreeFall:Connect SooGloezNoob 45 — 4y
0
thank you all though. SooGloezNoob 45 — 4y
Ad
Log in to vote
0
Answered by
1JBird1 64
4 years ago
Edited 4 years ago

I’ve edited it now, try this:

Instead of FallingDown do Freefall, which make should Line 4 look like:

1if NewState == Enum.HumanoidStateType.Freefall then

Hopefully this works out for you :D

0
Air doesn't seem to work, I've tried using this method with ==nil, every material, " " but nothing seems to work :( SooGloezNoob 45 — 4y
0
try Air with no " " and see what it does 1JBird1 64 — 4y

Answer this question