Avoid players jumping

Hi! I need help with a part of my script.
Is there a way to avoid players jumping? So they just jump when i want it?
PS: This is for my custom stamina script for my server…

You can always set the player’s jump power to 0, then when you want them to jump, set it to the default.


Well i’m using that but i found that you can bypass it by spamming the jump button in some cases. I found a fix to it. I moved my condition to the keypress detection. So all time a player press jump button it will instantly set the jumppower to 0 and cancel it. I hope this can help other people later too.