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 3 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?


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

2 answers

Log in to vote
1
Answered by 3 years ago
local Humanoid = script.Parent:WaitForChild("Humanoid")
local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
    if NewState == Enum.HumanoidStateType.FallingDown then
        print("falling")
    elseif NewState == Enum.HumanoidStateType.Landed then
        print("landed")
    end
end)

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 — 3y
0
I went into the animation script and it's literally as easy as: Humanoid.FreeFall:Connect SooGloezNoob 45 — 3y
0
thank you all though. SooGloezNoob 45 — 3y
Ad
Log in to vote
0
Answered by
1JBird1 64
3 years ago
Edited 3 years ago

I’ve edited it now, try this:

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

if 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 — 3y
0
try Air with no " " and see what it does 1JBird1 64 — 3y

Answer this question