I want to detect if a player is descending downwards. I’ve tried using humanoid states like FreeFalling and FallingDown, but both of which include jumping up, ascending, as falling. I’ve also tried the humanoid movement property, but it doesn’t change when falling. What should I do here?
1 Like
Have you tried checking for the velocity to change negatively?
Considering it’s falling, the Velocity of HRP changes
1 Like
The MoveDirection
property of the Humanoid
is a Vector3
value that tells you the direction the character is moving.
if humanoid.MoveDirection.Y < 0 then
-- Your character is moving downwards
end
1 Like
Thank you that works!
local plr = game.Players.LocalPlayer
local Char = plr.Character
local humanoid = Char.Humanoid
local hrp = Char.HumanoidRootPart
while true do
task.wait(0.1)
if hrp.Velocity.Y < 0 then
print("Falling")
end
end
2 Likes
Thank you! For some reason the MoveDirection stays at 0 when the player is moving through the Y-axis. It may have something to do with my game’s gravity being lower than the norm. I did get this to work though:
local plr = game.Players.LocalPlayer
local Char = plr.Character
local humanoid = Char.Humanoid
local hrp = Char.HumanoidRootPart
while true do
task.wait(0.1)
if hrp.Velocity.Y < 0 then
print("Falling")
end
end
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.