Hello there, I am trying to find out how to detect if a player is double jumping, I’ve looked on the dev forum and there is nothing from what I searched, I have also asked in other scripting help forums but nothing seems to work, any help is appreciated!
Here is a Developer Hub article dedicated to this topic:
If you want a double jump script, it’s not too complex. Put a LocalScript in StarterCharacterScripts:
local UIP = game:GetService("UserInputService")
local humanoid = script.Parent:WaitForChild("Humanoid")
local debounce = false
UIP.InputBegan:Connect(function(input)
if not debounce and humanoid:GetState() == Enum.HumanoidStateType.Freefall and input.KeyCode == Enum.KeyCode.Space then
debounce = true
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end)
humanoid.StateChanged:Connect(function(state)
if debounce and state == Enum.HumanoidStateType.Landed then
debounce = false
end
end)
Thank you, but that isn’t what I’m asking for, (that’s my fault I should have been more clear). I need to detect if a player IS double jumping, it’s for an anti-cheat system basically.
In order to keep track of whenever a player jumps, you can use the UserInputService.JumpRequest event, or look at the Humanoid.Jump property. The problem with this, is that most “double jump” exploiters aren’t actual double jumping. The way that the exploiters do it in most cases, is by placing a invisible anchored part underneath the player, right when they press “Jump” a second time. There have been threads on this already, and there seems to not be a genuine easy patch to this exploit.
It is extremely hard to detect, because the part is generated on the client, and therefore can not be checked via the server. And, any LocalScript checks can be easily just removed by any exploiter.
There is really only one method I know of to take out the majority of people that do this kind of thing. You need to log the positions and velocities of your character’s HumanoidRootParts constantly on the server, and compare them to try and detect abnormal activity. Here is a good post that states what I mean:
If using this method, it is also important not to punish the attacker too harshly. This is because of two main reasons. A, it could be a malfunction in your script, or ping, that triggers the a hacker detect, and banning an innocent for something they didn’t do could kill your game. And B, something as simple as teleporting the player back to this ground, is enough punishment. A simple deterrent like this, will make it hard to actually benefit from hacking like this, and then you don’t have the risk of accidentally kicking/banning a regular player.
To sum up, it is a bit of a challenge to stop client mobility exploit such as this one, except through close monitoring of the characters movement. It is do-able however, for the most part.
Good luck with your anti-cheat system!
Wow, thank you! (30 chars omg) (marked as solution for now as I think I made something but not quite sure)