How can I add iPhone/iPad support to my double jump fly script?

Greetings! I made it so on Mac, if you double press space, you will start flying as seen in the code below.

How would I add this to iPhone and iPad? The jump button is CoreGUI so it is a lot harder to track it. I looked into Humanoid.Jumping, but it doesn’t fire when you press the jump button, only when you actually start jumping and hit the floor. Humanoid.Jump does the same thing.

Is it possible to track when the user presses the Jump button on an iPhone or iPad? Thank you!

local UserInputService = game:GetService("UserInputService")

local DoubleTapThreshold = 0.3
local LastKeyPressTime = 0

UserInputService.InputBegan:Connect(function(key, gameProcessed)
	if gameProcessed then return end
	if key.KeyCode == KeyCode then
		local currentTime = tick()
		if currentTime - LastKeyPressTime <= DoubleTapThreshold then
			-- This is where I handle flying..
		LastKeyPressTime = currentTime

Yes. Use the JumpRequest in UserInputService

This thing fires like 3-10 times / jump… This is not going to work unfortunately.

Don’t worry, I found out how to get the jump button tapped.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.