I’m currently working on a dash\jump mechanic and I’m trying to make it mobile compatible. The first iteration of this system relied partially on JumpRequest, InputBegan on the GUI jump button for mobile and UserInputService. That system suddenly stopped working, and I couldn’t figure out why since it worked just fine until a few days ago & it displayed no errors.
I checked the Wiki, and figured that maybe it was a good idea to rewrite the code so that it relied exclusively on JumpRequest instead of repeating snippets of code to replicate the same functionalities on desktop and mobile, which is what I did.
This is the code (local script ofc)
local function onJumpRequest()
print("aye why this isn't firing on mobile lol")
if not Character or Humanoid:GetState() == HST.Dead then return end
if jumpDB then return end
jumpDB = true
--Vertical Dash
if jumpData.hasDoubleJumped then
Humanoid.JumpPower = jumpData.oldPower * jumpData.Multiplier + jumpData.flatMult
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
--Double Jump
if jumpData.canJumpAgain and jumpData.Jumps < jumpData.MaxJumps and not Movement:GetAttribute("isSprinting") and not jumpData.hasDoubleJumped then
Humanoid.JumpPower = jumpData.oldPower * jumpData.Multiplier
jumpAnimation()
Humanoid:ChangeState(HST.Jumping)
jumpData.hasDoubleJumped = true
movementRemote:FireServer("doubleJump",jumpData.hasDoubleJumped)
end
Service.RunS.Heartbeat:Wait()
end
--HumanoidStates--
Humanoid.StateChanged:Connect(function(oldState,newState) --Double Jump & Gliding
if HST.Landed == newState then
jumpData.Jumps = 0
jumpData.canJumpAgain = false
Humanoid.JumpPower = jumpData.oldPower
jumpData.hasDoubleJumped = false
jumpDB = false
if Movement:GetAttribute("hasDoubleJump") then
movementRemote:FireServer("Landed",jumpData.hasDoubleJumped)
end
elseif HST.Freefall == newState then
task.wait(jumpData.TimeBetweenJumps)
jumpData.canJumpAgain = true
jumpDB = false
elseif HST.Jumping == newState then
jumpData.canJumpAgain = false
jumpData.Jumps += 1
jumpDB = true
end
end)
Service.UIS.JumpRequest:Connect(onJumpRequest)
(My system has two different types of jumps, Double Jumps and Vertical Dashes. The dashes are supposed to be counted since there is a limit of dashes that can be executed by the player, but it’s irrilevant to the issue atm)
The code above works fine on desktop, but not on mobile. It doesn’t fire whatsoever and I’m starting to assume this is a problem on ROBLOX’s part since according to the Wiki, JumpRequest should also works on mobile. To prove this, I found two more threads that seem to share my same issue:
@DEVLocalPlayer did you ever figure out a fix for this?