How to ACTUALLY accurately detect when a player jumps

I have tried humanoid.Jumping, humanoid.StateChanged, some have suggested humanoid.Jump but that doesn’t work because it triggers whenever the player hits the jump button, not when he actually jumps, humanoid.StateChanged is not reliable and most of the time doesnt work, humanoid.Jumping is even more unreliable, almost all the time not working. How is doing something so simple got to be so hard? btw I’m making a jump counter

also im using custom rig

1 Like

Have you tried using UserInputService.JumpRequest?. While it detects when the player wants to jump, it is probably more reliable then the methods you stated. The only issue is that it can fire multiple times, but a simple debounce can fix that

How would I do that debounce then? because with my custom rig the jumppower can and will change constantly, sometimes even to ‘complex’ numbers (like 28.588 with decimals). it’s like the same problem as the humanoid.Jump

the only way i have thought of doing a debounce is waiting the time it takes for the character to land based on its jumppower

local deb
uis.JumpRequest:Connect(function()
  if deb then return end
  deb = true
  -- Set it to false after a while
end)

that’s the problem how much time would the “set it to false after a while” last? if its too low 2 jumps can be registered even when theres only 1, if its too much the player can jump twice and only 1 will be registered

that’s why i made this post, if roblox was convenient and gave me a 100% reliable option i wouldnt be making this post

In what cases are you running into issues with Humanoid.StateChanged? If I throw the following script into a LocalScript in StarterCharacterScripts, it prints every time I jump, even if I put a block above my head so that I jump nearly every frame.

local Character = script.Parent
if not Character then
	return
end

local Humanoid = Character:FindFirstChildOfClass("Humanoid")
while not Humanoid do
	Character.ChildAdded:Wait()
	Humanoid = Character:FindFirstChildOfClass("Humanoid")
end

Humanoid.StateChanged:Connect(function(Previous, Current)
	if Current == Enum.HumanoidStateType.Jumping then
		print("Jumped!")
	end
end)

when I jump, humanoid.StageChanged doesnt fire, only like 20% of the time, for no reason

Actually nvm, that doesn’t work.

Whenever the player presses the jump button, have you added a requirement to check if the input is not a gameProcessedEvent or attempted the method below?

I suggest using:

Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
	if Humanoid.Jump then
		
	end
end)

I suppose you can go the traditional way and detect key press with userinputservice.

uis.InputBegan:Connect(function(i,p)
   if p then return end
   if i.KeyCode == Enum.Keycode.Space then
      print("player jumped")
   end
end)

Edit: You can edit that boolean for jumprequest like this:

local canjump
uis.JumpRequest:Connect(function()
   if not canjump then return end
   print('player jumped')
end)
humanoid.Landed:Connect(function() --[[from my prev experience, landed
fires at least twice, which is why there's a simple check]]--
   if canjump then return end
   canjump = true
end)

like I said, state changes or things like .Jumped .Landed doesnt work for some reason, even with state changed.

the Jump property enables only when the player presses the jump button, not when he actually jumps

Then use RunService and detect upward vertical change along the y-axis?

1 Like

i use truss parts in my game and abilities that make you go up, it would false flag

Then during the check process, check if the character state is Enum.HumanoidStateType.Climbing.

why do you use .jumprequest and .statechanged? it’s what i use and it completely works fine for me with no inaccurate detection

i use something like this

local jumped = false;

UserInputService.JumpRequest:Connect(function()
	if (jumped) then
		return;
	end
	jumped = true;
end)

Humanoid.StateChanged:Connect(function(old, new)
	if (new == Enum.HumanoidStateType.Landed) then
		jumped = false; --// ???
	end
end)

I’m using a custom rig and for some reason .StateChanged completely breaks

Did you try:
humanoid.Jumping:Connect(function(active: boolean)

yes in the start post i said i already did, it’s even worser than state changed

what does this mean? can you post some output, print the state changes so you can show us

if statechanged doesn’t work, seems you need to fix your rig