Is there any event or method on mobile that fires before the humanoid processes the jump?
On PC, InputBegan with Enum.KeyCode.Space fires before the humanoid state changes from Running to Jumping.
On mobile, every method I’ve tried (JumpRequest, TouchGui.JumpButton.MouseButton1Click, Activated) fires after the state has already changed to Jumping.
I need to know when the player pressed jump while still grounded, but on mobile the state is already Jumping by the time any callback runs.
I’m detecting a “second jump while airborne” for ledge climbing. On PC I can ignore the first jump because state is still Running when the input fires. On mobile I can’t tell if the input was the jump that launched me or a mid-air press, both show Jumping state.
tried and its the same issue, by the time it fires, the state is already Jumping
on pc InputBegan with Space fires before the State changes, all methods i tried (JumpRequest, MouseButton1Click, Humanoid.Jump signal) fires after state is already Jumping.
--LocalScript in StarterPlayerScripts
local UIS = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid") --a stall
UIS.JumpRequest:Connect(function()
print("Jump input detected before state change")
end)
Not really sure about the reasoning behind the behavior mentioned, but you could try storing the time when state was changed and within of the mentioned events above you could check the difference in time and work accordingly