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:
The output results after jumping once:
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
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!
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.
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.