How to detect when a user is falling?

Hey, developers, I have a question how can I detect when a user is falling, without the Freefall state? this has been a question I had for a bunch of time and never found an answer, please respond if you know how to.

.

5 Likes

the only alternative one I know is for the Humanoid properties, FloorMaterial, detects on what material you’re stepping, including Air if you are falling

2 Likes

This won’t work for my situation… l

2 Likes

This post seems to have some solution that could be what youre looking for?

1 Like

Fairly simple, here are some ways to do it:

Without the freefall state

local Falling=false
humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
     Falling=humanoid.FloorMaterial==Enum.Material.Air
end

Without humanoid behavior at all (client sided)

local FallingTime=0
local RunService=game:GetService("RunService")
local part=Character.Torso
RunService.RenderStepped:Connect(function()
      Falling=part.AssemblyLinearVelocity.Y<0 
end)
4 Likes
local FallingTime=0
local RunService=game:GetService("RunService")
local part=Character.Torso
RunService.RenderStepped:Connect(function()
      Falling=part.AssemblyLinearVelocity.Y<0 
end)

Is there anyway to do this on server?

1 Like

Not advised if you’re going for a character controller due to delay.
but if you want to do it on server
change RenderStepped to Hearbeat

Edit:
you can delete the “FallingTime” :sweat_smile: accidently wrote it while thinking on an answer.

1 Like

Thank you, Ill test if it works!

2 Likes

Could you maybe explain what your situation is then? What’s your use case and why does the Freefalling state not work for it? If you share your use case for checking if the character is falling it might be easier to offer recommendations here or address your issue with using Freefalling.

2 Likes

It can be spoofed by exploiters

1 Like

What are you trying to accomplish?

1 Like

Detection of a user whenever he falls, not using FloorMaterial or States

1 Like

I dont understand why you don’t want to use the humanoid state then. Checking in other ways is inefficient and may cause a lot of issues in the long run if you don’t know how your script works.

1 Like

Its for an anti exploit, and using states exploiters could spoof it.

1 Like

So you are trying to make an anti fly script?

1 Like

I made an anti fly script, its just falling gives you false positives

1 Like

Wait, I just tested once of the comments and it works ? thought I’ll keep it temporary until i find a better one

(Now setting a solution to that comment)

1 Like

I have an Idea for that. Try using an invisible 0.01 stud block that gets spawned when the player starts falling while updating it’s Z and X coordinates. If they both dont fall in a reasonable time frame from each other. (aka block reaches the ground and fires an event) The player gets moderated.

Edit: This could also help with checks while having custom behaviour. For example double jumping could impose the same force on the block as the double jumping player. Preventing false positives.

2 Likes

This check works but may cause false positives when custom jumping behaviour is added.
Maybe this would work? (I mean it all comes down to what your game needs.)

1 Like

Hey, do you by chance know how to detect when a user is climbing (without the state) @WhiteOut_RBLX

1 Like