These two methods arent reliable, the events are fired multiple times and sometimes not at all. If possible id like to not resort to raycasting, detecting when the client press space isnt an option either.
I would probably use either ContextActionService:BindAction or Humanoid.StateChanged to bind a function:
-- Using ContextActionService:BindAction
ContextActionService:BindAction("OnJump", function(actionName, inputState, input)
-- proc here
return Enum.ContextActionResult.Pass
-- this enum passes processing to the
-- next action in line, most likely to the
-- ControlScript.
end, false, Enum.PlayerActions.CharacterJump)
-- Using Humanoid.StateChanged
Humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Freefall and (
old == Enum.HumanoidStateType.Running
or old == Enum.HumanoidStateType.RunningNoPhysics
) then
-- proc here
end
end)
Pretty sure StateChanged isn’t viable as its directly related to .Jumping. .Jumping fires when the humanoid state transitions to “jumping” I’m pretty sure.
I’m guessing you have been using Humanoid.Jumping's boolean active argument…
And I just found out that Enum.HumanoidStateType.Jumping is a thing:
Humanoid.StateChanged:Connect(function(old,new)
if
new == Enum.HumanoidStateType.Jumping and
--old == Running or RunningNoPhysics
then
--proc here
end
end)