I am currently using StateChanged to detect if a player is jumping, but it is extremely unreliable, as it only detects every 3 (or so) jumps.
My question is, is there a better way to detect player jumps (on the server)? If there is, what is this method?
Current Code:
local jumpPower
local isJumping = false
p.CharacterAdded:Connect(function(c)
jumpPower = c.Humanoid.JumpPower
local jumps = jumpAmount.Value / 10
jumps = jumps + 50
c.Humanoid.JumpPower = jumps
c.Humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not isJumping then
isJumping = true
jumpAmount.Value = jumpAmount.Value + 1
end
elseif newState == Enum.HumanoidStateType.Landed then
if isJumping then
isJumping = false
end
end
end)
end)
Thanks!