Humanoid freefalling checker fires multiple times upon landing, is there a fix for this?

I am trying to make a global script to detect when a player is in the air, and when they are on the ground.
It can’t be a local one, as it needs to do global changes, and if I use remotes, I am afraid that exploiters can sabotage other players by changing their state in the script.

The issue I am having is, that the code I am using for this seems to fire multiple times when the player lands. It doesn’t always do this, it seems to happen randomly. This would cause some glitches in the game, so I need some way to fix this, or an alternative to this. (The player Humanoid is called “Character”)
The code: image
The output results after jumping once: image

So far I have tried looking through other posts on the forum related to free falling to see if there are any good ways to check for it, but have not been able to find anything useful to my situation.
The player had a bodyforce in their root part to make them lighter. I tried removing it to see if that was causing something, but no, same results still.

The player character is a custom model, I am not sure if that is causing this?


Could the character be bouncing slightly and causing these double fires to happen?
They happen instantly after eachother, so it would be an extremely quick little bounce.
Plus the only part of the player model that has mass is the root part, so I don’t get it.

Thank you in advance if you’ll attempt to help me out. <3

2 Likes

So i don’t know if this may help much, but I’ve seen a debounce system used when detecting interactions between parts.

Here is the article explaining it.

Hope this helps!

1 Like

I will look into it! Thank you! <3

1 Like

I looked at what it was, and I had tried something like that.
The thing is, the timer would have to be quite small so that the player does not land again before it runs out. But despite having a debounce, it seems to still do it multiple times, as it does it all at the same time, so it doesn’t detect when the debounce is turned on.
I might just try some other method with a local script and stuff.
Thank you for your reply though!

1 Like

Uh. The purpose of a debounce is to ignore, so “it seems to still do it multiple times” seems like
maybe you didn’t fully grasp the concept? The timing is completely up to you for what works best.

Instead of using FreeFalling, try using StateChanged and check that the state is Landed.

1 Like

No, like it bypasses the debounce.
It does it multiple times at once, so by the time the debounce is turned on from the first time, the second time has already happened, making the debounce useless, as it can’t stop the second time from happening.

See if you can put a lockout flag as close to the top of the listener as possible as a test.

1 Like