How to check when a character has gone mid air when using body movers to go upwards

So I am making and action mmorpg and I need to detect when a player is mid air for airial attacks and to make you immune to default grabs and a few other things, I have been using a simple system where when the humanoid state has been changed to jumping or falling then they are airborne client side and tells the server to make them airborn server side and then make them grounded when they land
aside from other clients detecting this to late (if anyone gots a solution for this to that would be cool but its a minor problem thats mostly just a lag issue which I think is normal), I got no problems with this until I got some attacks that move the player up with body movers (mostly linier velocity) and so the state does not change to jumping or freefall when moving up but does when it finishes and there is no midair state other than these 2 so what should I do to check if they are going midair without manually changing it whenever the attack is activated
(I can show the code im using if anyone thinks they really need it but I dont see why you would)

I think you’ll just have to raycast down just below your characters feet. If the ray hits something (ignoring the character of course) then they are on the ground otherwise they are in the air.

Rather than costly raycasting, you could try to use the humanoid stateChanged event or the humanoid:GetState() function which would tell you if the player is midair.

I already do that, the problem is when using linier velocity to send the player up the state stays as running while moving up and does not change until they start falling, specifically when using humanoid:GetState() it outputs Enum.HumanoidStateType.Running, sorry I was a little unclear in my post

1 Like