Most reliable way to know if a Humanoid is on the floor?

I’m developing an anti-exploit for my game.
My script needs to find out if a player is off the ground.
I tried Rays and the Humanoid.FloorMaterial but both methods have massive flaws.

image
If a player were to stand off a edge like this, the Ray (represented by red line) wouldn’t hit the part that the player is actually standing on. Therefore, causing the script to break.

The Humanoid.FloorMaterial property is client sided. So if an exploiter creates a part locally underneath themselves and flies, the script will still think that the player is on a part even though they are not.

Any other methods will be a great help to me.

1 Like

Cast four rays downward, one on each corner of the HumanoidRootPart. Since the rays are really short, you shouldn’t experience any performance issues with this.

Note: You want to be careful of false-positives. For instance, what if the player is simply falling off of an object? You don’t want to kick the player for simply falling. Or for simply jumping.

Otherwise, I guess you could simply watch the player’s velocity. If their speed is unusually high, then maybe they’re doing something they’re not supposed to do?

5 Likes

Thank you, I can’t believe that I didn’t think about this.
Also, I already coded the logic and it works just fine but this was just the final section I need to add.

1 Like