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
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
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)
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)
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)